mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-02 13:42:15 +02:00
server+htlcswitch: check waiting-close fwdpkgs in reforwardResponses
Previously, the Switch would not check waiting-close channels' fwdpkgs for settles or fails to reforward. This could result in a force close in a rare edge case if a restart occurred at the wrong time. Now, waiting-close fwdpkgs are checked and the issue is avoided.
This commit is contained in:
@@ -145,6 +145,10 @@ type Config struct {
|
||||
// channels from the channel database.
|
||||
FetchAllOpenChannels func() ([]*channeldb.OpenChannel, error)
|
||||
|
||||
// FetchAllChannels is a function that fetches all pending open, open,
|
||||
// and waiting close channels from the database.
|
||||
FetchAllChannels func() ([]*channeldb.OpenChannel, error)
|
||||
|
||||
// FetchClosedChannels is a function that fetches all closed channels
|
||||
// from the channel database.
|
||||
FetchClosedChannels func(
|
||||
@@ -2083,9 +2087,11 @@ func (s *Switch) reforwardResolutions() error {
|
||||
|
||||
// reforwardResponses for every known, non-pending channel, loads all associated
|
||||
// forwarding packages and reforwards any Settle or Fail HTLCs found. This is
|
||||
// used to resurrect the switch's mailboxes after a restart.
|
||||
// used to resurrect the switch's mailboxes after a restart. This also runs for
|
||||
// waiting close channels since there may be settles or fails that need to be
|
||||
// reforwarded before they completely close.
|
||||
func (s *Switch) reforwardResponses() error {
|
||||
openChannels, err := s.cfg.FetchAllOpenChannels()
|
||||
openChannels, err := s.cfg.FetchAllChannels()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user