@@ -108,8 +108,10 @@ type ChannelLinkConfig struct {
108
108
// blobs, which are then used to inform how to forward an HTLC.
109
109
//
110
110
// NOTE: This function assumes the same set of readers and preimages
111
- // are always presented for the same identifier.
112
- DecodeHopIterators func ([]byte , []hop.DecodeHopIteratorRequest ) (
111
+ // are always presented for the same identifier. The last boolean is
112
+ // used to decide whether this is a reforwarding or not - when it's
113
+ // reforwarding, we skip the replay check enforced in our decay log.
114
+ DecodeHopIterators func ([]byte , []hop.DecodeHopIteratorRequest , bool ) (
113
115
[]hop.DecodeHopIteratorResponse , error )
114
116
115
117
// ExtractErrorEncrypter function is responsible for decoding HTLC
@@ -3764,12 +3766,14 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
3764
3766
}
3765
3767
}
3766
3768
3769
+ reforward := fwdPkg .State != channeldb .FwdStateLockedIn
3770
+
3767
3771
// Atomically decode the incoming htlcs, simultaneously checking for
3768
3772
// replay attempts. A particular index in the returned, spare list of
3769
3773
// channel iterators should only be used if the failure code at the
3770
3774
// same index is lnwire.FailCodeNone.
3771
3775
decodeResps , sphinxErr := l .cfg .DecodeHopIterators (
3772
- fwdPkg .ID (), decodeReqs ,
3776
+ fwdPkg .ID (), decodeReqs , reforward ,
3773
3777
)
3774
3778
if sphinxErr != nil {
3775
3779
l .failf (LinkFailureError {code : ErrInternalError },
@@ -4120,17 +4124,15 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
4120
4124
return
4121
4125
}
4122
4126
4123
- replay := fwdPkg .State != channeldb .FwdStateLockedIn
4124
-
4125
- l .log .Debugf ("forwarding %d packets to switch: replay=%v" ,
4126
- len (switchPackets ), replay )
4127
+ l .log .Debugf ("forwarding %d packets to switch: reforward=%v" ,
4128
+ len (switchPackets ), reforward )
4127
4129
4128
4130
// NOTE: This call is made synchronous so that we ensure all circuits
4129
4131
// are committed in the exact order that they are processed in the link.
4130
4132
// Failing to do this could cause reorderings/gaps in the range of
4131
4133
// opened circuits, which violates assumptions made by the circuit
4132
4134
// trimming.
4133
- l .forwardBatch (replay , switchPackets ... )
4135
+ l .forwardBatch (reforward , switchPackets ... )
4134
4136
}
4135
4137
4136
4138
// experimentalEndorsement returns the value to set for our outgoing
0 commit comments