mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-05 18:31:37 +01:00
lnwallet+sweep: introduce TxPublisher to handle fee bump
This commit adds `TxPublisher` which implements `Bumper` interface. This is part one of the implementation that focuses on implementing the `Broadcast` method which guarantees a tx can be published with RBF-compliant. It does so by leveraging the `testmempoolaccept` API, keep increasing the fee rate until an RBF-compliant tx is made and broadcasts it. This tx will then be monitored by the `TxPublisher` and in the following commit, the monitoring process will be added.
This commit is contained in:
@@ -493,3 +493,32 @@ func (m *MockBumper) Broadcast(req *BumpRequest) (<-chan *BumpResult, error) {
|
||||
|
||||
return args.Get(0).(chan *BumpResult), args.Error(1)
|
||||
}
|
||||
|
||||
// MockFeeFunction is a mock implementation of the FeeFunction interface.
|
||||
type MockFeeFunction struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Compile-time constraint to ensure MockFeeFunction implements FeeFunction.
|
||||
var _ FeeFunction = (*MockFeeFunction)(nil)
|
||||
|
||||
// FeeRate returns the current fee rate calculated by the fee function.
|
||||
func (m *MockFeeFunction) FeeRate() chainfee.SatPerKWeight {
|
||||
args := m.Called()
|
||||
|
||||
return args.Get(0).(chainfee.SatPerKWeight)
|
||||
}
|
||||
|
||||
// Increment adds one delta to the current fee rate.
|
||||
func (m *MockFeeFunction) Increment() (bool, error) {
|
||||
args := m.Called()
|
||||
|
||||
return args.Bool(0), args.Error(1)
|
||||
}
|
||||
|
||||
// IncreaseFeeRate increases the fee rate by one step.
|
||||
func (m *MockFeeFunction) IncreaseFeeRate(confTarget uint32) (bool, error) {
|
||||
args := m.Called(confTarget)
|
||||
|
||||
return args.Bool(0), args.Error(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user