mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 07:35:07 +02:00
sweep: remove conflicted sweep txns from the rebroadcaster
In this commit, we an existing gap in our rebroadcast handling logic. As is, if we're trying to sweep a transaction and a conflicting transaction is mined (timeout lands on chain, anchor swept), then we'll continue to try to rebroadcast the tx in the background. To resolve this, we give the sweeper a new closure function that it can use to mark conflicted transactions as no longer requiring rebroadcast.
This commit is contained in:
25
sweeper_wallet.go
Normal file
25
sweeper_wallet.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package lnd
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
)
|
||||
|
||||
// sweeperWallet is a wrapper around the LightningWallet that implements the
|
||||
// sweeper's Wallet interface.
|
||||
type sweeperWallet struct {
|
||||
*lnwallet.LightningWallet
|
||||
}
|
||||
|
||||
// newSweeperWallet creates a new sweeper wallet from the given
|
||||
// LightningWallet.
|
||||
func newSweeperWallet(w *lnwallet.LightningWallet) *sweeperWallet {
|
||||
return &sweeperWallet{
|
||||
LightningWallet: w,
|
||||
}
|
||||
}
|
||||
|
||||
// CancelRebroadcast cancels the rebroadcast of the given transaction.
|
||||
func (s *sweeperWallet) CancelRebroadcast(txid chainhash.Hash) {
|
||||
s.Cfg.Rebroadcaster.MarkAsConfirmed(txid)
|
||||
}
|
Reference in New Issue
Block a user