sweep: introduce Bumper interface to handle RBF
This commit adds a new interface, `Bumper`, to handle RBF for a given input set. It's responsible for creating the sweeping tx using the input set, and monitors its confirmation status to decide whether a RBF should be attempted or not. We leave implementation details to future commits, and focus on mounting this `Bumper` interface to our sweeper in this commit.
This commit is contained in:
5 files changed
+812
-51
No files matched your search
@@ -462,3 +462,22 @@ func (m *MockInputSet) Budget() btcutil.Amount {
|
||||
|
||||
return args.Get(0).(btcutil.Amount)
|
||||
}
|
||||
|
||||
// MockBumper is a mock implementation of the interface Bumper.
|
||||
type MockBumper struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Compile-time constraint to ensure MockBumper implements Bumper.
|
||||
var _ Bumper = (*MockBumper)(nil)
|
||||
|
||||
// Broadcast broadcasts the transaction to the network.
|
||||
func (m *MockBumper) Broadcast(req *BumpRequest) (<-chan *BumpResult, error) {
|
||||
args := m.Called(req)
|
||||
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
|
||||
return args.Get(0).(chan *BumpResult), args.Error(1)
|
||||
}
|
||||
Reference in new issue
Block a user