mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 15:40:59 +02:00
multi: add new method ChainArbitrator.RedispatchBlockbeat
This commit adds a new method to enable us resending the blockbeat in `ChainArbitrator`, which is needed for the channel restore as the chain watcher and channel arbitrator are added after the start of the chain arbitrator.
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chanbackup"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
@@ -286,6 +287,9 @@ func (c *chanDBRestorer) RestoreChansFromSingles(backups ...chanbackup.Single) e
|
||||
|
||||
ltndLog.Infof("Informing chain watchers of new restored channels")
|
||||
|
||||
// Create a slice of channel points.
|
||||
chanPoints := make([]wire.OutPoint, 0, len(channelShells))
|
||||
|
||||
// Finally, we'll need to inform the chain arbitrator of these new
|
||||
// channels so we'll properly watch for their ultimate closure on chain
|
||||
// and sweep them via the DLP.
|
||||
@@ -294,8 +298,15 @@ func (c *chanDBRestorer) RestoreChansFromSingles(backups ...chanbackup.Single) e
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
chanPoints = append(
|
||||
chanPoints, restoredChannel.Chan.FundingOutpoint,
|
||||
)
|
||||
}
|
||||
|
||||
// With all the channels restored, we'll now re-send the blockbeat.
|
||||
c.chainArb.RedispatchBlockbeat(chanPoints)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -314,7 +325,7 @@ func (s *server) ConnectPeer(nodePub *btcec.PublicKey, addrs []net.Addr) error {
|
||||
// to ensure the new connection is created after this new link/channel
|
||||
// is known.
|
||||
if err := s.DisconnectPeer(nodePub); err != nil {
|
||||
ltndLog.Infof("Peer(%v) is already connected, proceeding "+
|
||||
ltndLog.Infof("Peer(%x) is already connected, proceeding "+
|
||||
"with chan restore", nodePub.SerializeCompressed())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user