@@ -3632,6 +3632,13 @@ func (l *channelLink) processRemoteSettleFails(fwdPkg *channeldb.FwdPkg) {
3632
3632
return
3633
3633
}
3634
3634
3635
+ // Exit early if the fwdPkg is already processed.
3636
+ if fwdPkg .State == channeldb .FwdStateCompleted {
3637
+ l .log .Debugf ("skipped processing completed fwdPkg %v" , fwdPkg )
3638
+
3639
+ return
3640
+ }
3641
+
3635
3642
l .log .Debugf ("settle-fail-filter: %v" , fwdPkg .SettleFailFilter )
3636
3643
3637
3644
var switchPackets []* htlcPacket
@@ -3740,6 +3747,13 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
3740
3747
return
3741
3748
}
3742
3749
3750
+ // Exit early if the fwdPkg is already processed.
3751
+ if fwdPkg .State == channeldb .FwdStateCompleted {
3752
+ l .log .Debugf ("skipped processing completed fwdPkg %v" , fwdPkg )
3753
+
3754
+ return
3755
+ }
3756
+
3743
3757
l .log .Tracef ("processing %d remote adds for height %d" ,
3744
3758
len (fwdPkg .Adds ), fwdPkg .Height )
3745
3759
@@ -3766,7 +3780,9 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
3766
3780
}
3767
3781
}
3768
3782
3769
- reforward := fwdPkg .State != channeldb .FwdStateLockedIn
3783
+ // If the fwdPkg has already been processed, it means we are
3784
+ // reforwarding the packets again, which happens only on a restart.
3785
+ reforward := fwdPkg .State == channeldb .FwdStateProcessed
3770
3786
3771
3787
// Atomically decode the incoming htlcs, simultaneously checking for
3772
3788
// replay attempts. A particular index in the returned, spare list of
0 commit comments