Skip to content

Commit 4f2c75f

Browse files
committed
htlcswitch: also set packet amount on modified forward
This fixes an issue where the switch's forwarding logic would think the bandwidth to forward an HTLC was insufficient for a custom channel HTLC, because we only overwrote the HTLC's amount and not the packet's (which is just a short cut struct member anyway).
1 parent 374b659 commit 4f2c75f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

htlcswitch/interceptable_switch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ func (f *interceptedForward) ResumeModified(
658658
switch htlc := f.packet.htlc.(type) {
659659
case *lnwire.UpdateAddHTLC:
660660
outgoingAmountMsat.WhenSome(func(amount lnwire.MilliSatoshi) {
661+
f.packet.amount = amount
661662
htlc.Amount = amount
662663
})
663664

itest/lnd_forward_interceptor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func testForwardInterceptorModifiedHtlc(ht *lntest.HarnessTest) {
407407
customRecords[crKey] = crValue
408408

409409
action := routerrpc.ResolveHoldForwardAction_RESUME_MODIFIED
410-
newOutgoingAmountMsat := packet.OutgoingAmountMsat + 4000
410+
newOutgoingAmountMsat := packet.OutgoingAmountMsat
411411

412412
err := bobInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
413413
IncomingCircuitKey: packet.IncomingCircuitKey,

0 commit comments

Comments
 (0)