mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-05 12:39:54 +02:00
Merge pull request #6789 from Crypt-iQ/waitingclose
server+htlcswitch: check waiting-close fwdpkgs in reforwardResponses
This commit is contained in:
commit
bc5638428e
@ -45,6 +45,9 @@ minimum version needed to build the project.
|
|||||||
|
|
||||||
## Misc
|
## Misc
|
||||||
|
|
||||||
|
* [Fixed a bug where the Switch did not reforward settles or fails for
|
||||||
|
waiting-close channels](https://github.com/lightningnetwork/lnd/pull/6789)
|
||||||
|
|
||||||
* [Fixed a flake in the TestChannelLinkCancelFullCommitment unit
|
* [Fixed a flake in the TestChannelLinkCancelFullCommitment unit
|
||||||
test](https://github.com/lightningnetwork/lnd/pull/6792).
|
test](https://github.com/lightningnetwork/lnd/pull/6792).
|
||||||
|
|
||||||
|
@ -194,6 +194,7 @@ func initSwitchWithDB(startingHeight uint32, db *channeldb.DB) (*Switch, error)
|
|||||||
cfg := Config{
|
cfg := Config{
|
||||||
DB: db,
|
DB: db,
|
||||||
FetchAllOpenChannels: db.ChannelStateDB().FetchAllOpenChannels,
|
FetchAllOpenChannels: db.ChannelStateDB().FetchAllOpenChannels,
|
||||||
|
FetchAllChannels: db.ChannelStateDB().FetchAllChannels,
|
||||||
FetchClosedChannels: db.ChannelStateDB().FetchClosedChannels,
|
FetchClosedChannels: db.ChannelStateDB().FetchClosedChannels,
|
||||||
SwitchPackager: channeldb.NewSwitchPackager(),
|
SwitchPackager: channeldb.NewSwitchPackager(),
|
||||||
FwdingLog: &mockForwardingLog{
|
FwdingLog: &mockForwardingLog{
|
||||||
|
@ -145,6 +145,10 @@ type Config struct {
|
|||||||
// channels from the channel database.
|
// channels from the channel database.
|
||||||
FetchAllOpenChannels func() ([]*channeldb.OpenChannel, error)
|
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
|
// FetchClosedChannels is a function that fetches all closed channels
|
||||||
// from the channel database.
|
// from the channel database.
|
||||||
FetchClosedChannels func(
|
FetchClosedChannels func(
|
||||||
@ -2083,9 +2087,11 @@ func (s *Switch) reforwardResolutions() error {
|
|||||||
|
|
||||||
// reforwardResponses for every known, non-pending channel, loads all associated
|
// reforwardResponses for every known, non-pending channel, loads all associated
|
||||||
// forwarding packages and reforwards any Settle or Fail HTLCs found. This is
|
// 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 {
|
func (s *Switch) reforwardResponses() error {
|
||||||
openChannels, err := s.cfg.FetchAllOpenChannels()
|
openChannels, err := s.cfg.FetchAllChannels()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -630,6 +630,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
s.htlcSwitch, err = htlcswitch.New(htlcswitch.Config{
|
s.htlcSwitch, err = htlcswitch.New(htlcswitch.Config{
|
||||||
DB: dbs.ChanStateDB,
|
DB: dbs.ChanStateDB,
|
||||||
FetchAllOpenChannels: s.chanStateDB.FetchAllOpenChannels,
|
FetchAllOpenChannels: s.chanStateDB.FetchAllOpenChannels,
|
||||||
|
FetchAllChannels: s.chanStateDB.FetchAllChannels,
|
||||||
FetchClosedChannels: s.chanStateDB.FetchClosedChannels,
|
FetchClosedChannels: s.chanStateDB.FetchClosedChannels,
|
||||||
LocalChannelClose: func(pubKey []byte,
|
LocalChannelClose: func(pubKey []byte,
|
||||||
request *htlcswitch.ChanClose) {
|
request *htlcswitch.ChanClose) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user