From 2708626d629ae92a5c5a8273cf7803c122c73f81 Mon Sep 17 00:00:00 2001 From: ziggie Date: Tue, 11 Jul 2023 09:05:22 +0200 Subject: [PATCH] lnwallet: add CancelRebroadcast method. Adding the ability to stop rebroadcasting a transaction. This is useful when we want to abandon a channel and grantee that this transaction will not confirm accidentally. --- lnwallet/wallet.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index 200939da3..31954bfbf 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -2315,6 +2315,15 @@ func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel, return nil } +// CancelRebroadcast cancels the rebroadcast of the given transaction. +func (l *LightningWallet) CancelRebroadcast(txid chainhash.Hash) { + // For neutrino, we don't config the rebroadcaster for the wallet as it + // manages the rebroadcasting logic in neutrino itself. + if l.Cfg.Rebroadcaster != nil { + l.Cfg.Rebroadcaster.MarkAsConfirmed(txid) + } +} + // CoinSource is a wrapper around the wallet that implements the // chanfunding.CoinSource interface. type CoinSource struct {