lnd/lnwallet/rebroadcaster.go
Olaoluwa Osuntokun 10929d80cc
lnwallet: add new rebroadcaster interface, use for background tx publish
In this commit, we add a new Rebroadcaster interface to be used for
publishing transactions passively in the background until they've been
confirmed on chain. This is useful if a tx drops out of the mempool, but
then the pool clears down and has more space available to accept the tx
at the current fee level.
2023-03-10 19:07:35 -08:00

28 lines
777 B
Go

package lnwallet
import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
)
// Rebroadcaster is an abstract rebroadcaster instance that'll continually
// rebroadcast transactions in the background until they're confirmed.
type Rebroadcaster interface {
// Start launches all goroutines the rebroadcaster needs to operate.
Start() error
// Started returns true if the broadcaster is already active.
Started() bool
// Stop terminates the rebroadcaster and all goroutines it spawned.
Stop()
// Broadcast enqueues a transaction to be rebroadcast until it's been
// confirmed.
Broadcast(tx *wire.MsgTx) error
// MarkAsConfirmed marks a transaction as confirmed, so it won't be
// rebroadcast.
MarkAsConfirmed(txid chainhash.Hash)
}