multi: remove pending channel from Brontide when funding flow failed
This commit adds a new interface method, `RemovePendingChannel`, to be used when the funding flow is failed after calling `AddPendingChannel` such that the Brontide has the most up-to-date view of the active channels.
This commit is contained in:
7 files changed
+97
-1
No files matched your search
+13
-1
@@ -894,9 +894,21 @@ func (c *chanIdentifier) hasChanID() bool {
|
||||
func (f *Manager) failFundingFlow(peer lnpeer.Peer, cid *chanIdentifier,
|
||||
fundingErr error) {
|
||||
|
||||
log.Debugf("Failing funding flow for pending_id=%x: %v",
|
||||
log.Debugf("Failing funding flow for pending_id=%v: %v",
|
||||
cid.tempChanID, fundingErr)
|
||||
|
||||
// First, notify Brontide to remove the pending channel.
|
||||
//
|
||||
// NOTE: depending on where we fail the flow, we may not have the
|
||||
// active channel ID yet.
|
||||
if cid.hasChanID() {
|
||||
err := peer.RemovePendingChannel(cid.chanID)
|
||||
if err != nil {
|
||||
log.Errorf("Unable to remove channel %v with peer %x: "+
|
||||
"%v", cid, peer.IdentityKey(), err)
|
||||
}
|
||||
}
|
||||
|
||||
ctx, err := f.cancelReservationCtx(
|
||||
peer.IdentityKey(), cid.tempChanID, false,
|
||||
)
|
||||
|
||||
@@ -327,6 +327,10 @@ func (n *testNode) AddPendingChannel(_ lnwire.ChannelID,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *testNode) RemovePendingChannel(_ lnwire.ChannelID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createTestWallet(cdb *channeldb.ChannelStateDB, netParams *chaincfg.Params,
|
||||
notifier chainntnfs.ChainNotifier, wc lnwallet.WalletController,
|
||||
signer input.Signer, keyRing keychain.SecretKeyRing,
|
||||
|
||||
Reference in new issue
Block a user