mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-29 02:00:54 +02:00
peer: retry enabling channels on ErrEnableInactiveChan
This commit adds a retry logic to the channels that failed with `ErrEnableInactiveChan` when requesting enabling. We now subscribe the channel events to decide what to do with the failed channels.
This commit is contained in:
@ -12,6 +12,7 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channelnotifier"
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
@ -1035,6 +1036,14 @@ func TestPeerCustomMessage(t *testing.T) {
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
|
||||
// TODO(yy): change ChannelNotifier to be an interface.
|
||||
channelNotifier := channelnotifier.New(dbAlice.ChannelStateDB())
|
||||
require.NoError(t, channelNotifier.Start())
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, channelNotifier.Stop(),
|
||||
"stop channel notifier failed")
|
||||
})
|
||||
|
||||
alicePeer := NewBrontide(Config{
|
||||
PubKeyBytes: remoteKey,
|
||||
ChannelDB: dbAlice.ChannelStateDB(),
|
||||
@ -1057,7 +1066,8 @@ func TestPeerCustomMessage(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
},
|
||||
PongBuf: make([]byte, lnwire.MaxPongBytes),
|
||||
PongBuf: make([]byte, lnwire.MaxPongBytes),
|
||||
ChannelNotifier: channelNotifier,
|
||||
})
|
||||
|
||||
// Set up the init sequence.
|
||||
|
Reference in New Issue
Block a user