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).
This commit is contained in:
Oliver Gugger 2024-07-11 19:01:04 +02:00
parent 374b659476
commit 4f2c75f620
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
2 changed files with 2 additions and 1 deletions

View File

@ -658,6 +658,7 @@ func (f *interceptedForward) ResumeModified(
switch htlc := f.packet.htlc.(type) {
case *lnwire.UpdateAddHTLC:
outgoingAmountMsat.WhenSome(func(amount lnwire.MilliSatoshi) {
f.packet.amount = amount
htlc.Amount = amount
})

View File

@ -407,7 +407,7 @@ func testForwardInterceptorModifiedHtlc(ht *lntest.HarnessTest) {
customRecords[crKey] = crValue
action := routerrpc.ResolveHoldForwardAction_RESUME_MODIFIED
newOutgoingAmountMsat := packet.OutgoingAmountMsat + 4000
newOutgoingAmountMsat := packet.OutgoingAmountMsat
err := bobInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
IncomingCircuitKey: packet.IncomingCircuitKey,