mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
10929d80cc
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.
28 lines
777 B
Go
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)
|
|
}
|