@@ -29,7 +29,9 @@ import (
2929 "github.com/lightningnetwork/lnd/lnwallet/chainfee"
3030 "github.com/lightningnetwork/lnd/lnwire"
3131 "github.com/lightningnetwork/lnd/queue"
32+ "github.com/lightningnetwork/lnd/record"
3233 "github.com/lightningnetwork/lnd/ticker"
34+ "github.com/lightningnetwork/lnd/tlv"
3335)
3436
3537func init () {
@@ -3354,6 +3356,27 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
33543356 continue
33553357 }
33563358
3359+ var customRecords record.CustomSet
3360+ err = fn .MapOptionZ (
3361+ pd .CustomRecords , func (b tlv.Blob ) error {
3362+ r , err := lnwire .ParseCustomRecords (b )
3363+ if err != nil {
3364+ return err
3365+ }
3366+
3367+ customRecords = record .CustomSet (r )
3368+
3369+ return nil
3370+ },
3371+ )
3372+ if err != nil {
3373+ l .fail (LinkFailureError {
3374+ code : ErrInternalError ,
3375+ }, err .Error ())
3376+
3377+ return
3378+ }
3379+
33573380 switch fwdPkg .State {
33583381 case channeldb .FwdStateProcessed :
33593382 // This add was not forwarded on the previous
@@ -3367,7 +3390,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
33673390 }
33683391
33693392 // Otherwise, it was already processed, we can
3370- // can collect it and continue.
3393+ // collect it and continue.
33713394 addMsg := & lnwire.UpdateAddHTLC {
33723395 Expiry : fwdInfo .OutgoingCTLV ,
33733396 Amount : fwdInfo .AmountToForward ,
@@ -3387,19 +3410,21 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
33873410
33883411 inboundFee := l .cfg .FwrdingPolicy .InboundFee
33893412
3413+ //nolint:lll
33903414 updatePacket := & htlcPacket {
3391- incomingChanID : l .ShortChanID (),
3392- incomingHTLCID : pd .HtlcIndex ,
3393- outgoingChanID : fwdInfo .NextHop ,
3394- sourceRef : pd .SourceRef ,
3395- incomingAmount : pd .Amount ,
3396- amount : addMsg .Amount ,
3397- htlc : addMsg ,
3398- obfuscator : obfuscator ,
3399- incomingTimeout : pd .Timeout ,
3400- outgoingTimeout : fwdInfo .OutgoingCTLV ,
3401- customRecords : pld .CustomRecords (),
3402- inboundFee : inboundFee ,
3415+ incomingChanID : l .ShortChanID (),
3416+ incomingHTLCID : pd .HtlcIndex ,
3417+ outgoingChanID : fwdInfo .NextHop ,
3418+ sourceRef : pd .SourceRef ,
3419+ incomingAmount : pd .Amount ,
3420+ amount : addMsg .Amount ,
3421+ htlc : addMsg ,
3422+ obfuscator : obfuscator ,
3423+ incomingTimeout : pd .Timeout ,
3424+ outgoingTimeout : fwdInfo .OutgoingCTLV ,
3425+ customRecords : pld .CustomRecords (),
3426+ inboundFee : inboundFee ,
3427+ incomingCustomRecords : customRecords ,
34033428 }
34043429 switchPackets = append (
34053430 switchPackets , updatePacket ,
@@ -3455,19 +3480,21 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
34553480 if fwdPkg .State == channeldb .FwdStateLockedIn {
34563481 inboundFee := l .cfg .FwrdingPolicy .InboundFee
34573482
3483+ //nolint:lll
34583484 updatePacket := & htlcPacket {
3459- incomingChanID : l .ShortChanID (),
3460- incomingHTLCID : pd .HtlcIndex ,
3461- outgoingChanID : fwdInfo .NextHop ,
3462- sourceRef : pd .SourceRef ,
3463- incomingAmount : pd .Amount ,
3464- amount : addMsg .Amount ,
3465- htlc : addMsg ,
3466- obfuscator : obfuscator ,
3467- incomingTimeout : pd .Timeout ,
3468- outgoingTimeout : fwdInfo .OutgoingCTLV ,
3469- customRecords : pld .CustomRecords (),
3470- inboundFee : inboundFee ,
3485+ incomingChanID : l .ShortChanID (),
3486+ incomingHTLCID : pd .HtlcIndex ,
3487+ outgoingChanID : fwdInfo .NextHop ,
3488+ sourceRef : pd .SourceRef ,
3489+ incomingAmount : pd .Amount ,
3490+ amount : addMsg .Amount ,
3491+ htlc : addMsg ,
3492+ obfuscator : obfuscator ,
3493+ incomingTimeout : pd .Timeout ,
3494+ outgoingTimeout : fwdInfo .OutgoingCTLV ,
3495+ customRecords : pld .CustomRecords (),
3496+ inboundFee : inboundFee ,
3497+ incomingCustomRecords : customRecords ,
34713498 }
34723499
34733500 fwdPkg .FwdFilter .Set (idx )
0 commit comments