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.
This commit is contained in:
3 files changed
+104
No files matched your search
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user