@@ -847,18 +847,23 @@ func (l *channelLink) htlcManager() {
847
847
848
848
// After cleaning up any memory pertaining to incoming packets, we now
849
849
// replay our forwarding packages to handle any htlcs that can be
850
- // processed locally, or need to be forwarded out to the switch.
851
- if err := l .resolveFwdPkgs (); err != nil {
852
- l .fail (LinkFailureError {code : ErrInternalError },
853
- "unable to resolve fwd pkgs: %v" , err )
854
- return
855
- }
850
+ // processed locally, or need to be forwarded out to the switch. We will
851
+ // only attempt to resolve packages if our short chan id indicates that
852
+ // the channel is not pending, otherwise we should have no htlcs to
853
+ // reforward.
854
+ if l .ShortChanID () != sourceHop {
855
+ if err := l .resolveFwdPkgs (); err != nil {
856
+ l .fail (LinkFailureError {code : ErrInternalError },
857
+ "unable to resolve fwd pkgs: %v" , err )
858
+ return
859
+ }
856
860
857
- // With our link's in-memory state fully reconstructed, spawn a
858
- // goroutine to manage the reclamation of disk space occupied by
859
- // completed forwarding packages.
860
- l .wg .Add (1 )
861
- go l .fwdPkgGarbager ()
861
+ // With our link's in-memory state fully reconstructed, spawn a
862
+ // goroutine to manage the reclamation of disk space occupied by
863
+ // completed forwarding packages.
864
+ l .wg .Add (1 )
865
+ go l .fwdPkgGarbager ()
866
+ }
862
867
863
868
out:
864
869
for {
@@ -1670,6 +1675,11 @@ func (l *channelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
1670
1675
}
1671
1676
}()
1672
1677
1678
+ // Now that the short channel ID has been properly updated, we can begin
1679
+ // garbage collecting any forwarding packages we create.
1680
+ l .wg .Add (1 )
1681
+ go l .fwdPkgGarbager ()
1682
+
1673
1683
return sid , nil
1674
1684
}
1675
1685
0 commit comments