sweep: add monitor loop to TxPublisher

This commit finishes the implementation of `TxPublisher` by adding the
monitor process. Whenever a new block arrives, the publisher will check
all its monitored records and attempt fee bumping them if necessary.
This commit is contained in:
yyforyongyu
2024-02-29 19:36:37 +08:00
parent 11f7e455d1
commit 90e727a776
5 changed files with 725 additions and 64 deletions

View File

@ -175,6 +175,14 @@ func (b *mockBackend) FetchTx(chainhash.Hash) (*wire.MsgTx, error) {
func (b *mockBackend) CancelRebroadcast(tx chainhash.Hash) {
}
// GetTransactionDetails returns a detailed description of a tx given its
// transaction hash.
func (b *mockBackend) GetTransactionDetails(txHash *chainhash.Hash) (
*lnwallet.TransactionDetail, error) {
return nil, nil
}
// mockFeeEstimator implements a mock fee estimator. It closely resembles
// lnwallet.StaticFeeEstimator with the addition that fees can be changed for
// testing purposes in a thread safe manner.
@ -418,6 +426,20 @@ func (m *MockWallet) CancelRebroadcast(tx chainhash.Hash) {
m.Called(tx)
}
// GetTransactionDetails returns a detailed description of a tx given its
// transaction hash.
func (m *MockWallet) GetTransactionDetails(txHash *chainhash.Hash) (
*lnwallet.TransactionDetail, error) {
args := m.Called(txHash)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*lnwallet.TransactionDetail), args.Error(1)
}
// MockInputSet is a mock implementation of the InputSet interface.
type MockInputSet struct {
mock.Mock