Commit Graph

9 Commits

Author SHA1 Message Date
yyforyongyu
4c13ea1747
sweep: pass default deadline height when clustering inputs
This commit changes the method `ClusterInputs` to also take a default
deadline height. Previously, when calculating the default deadline
height for a non-time sensitive input, we would first cluster it with
other non-time sensitive inputs, then give it a deadline before we are
about to `sweep`. This is now moved to the step where we decide to
cluster inputs, allowing time-sensitive and non-sensitive inputs to be
grouped together, if they happen to share the same deadline heights.
2024-04-19 21:33:32 +08:00
yyforyongyu
28df2d7327
lnrpc+sweep: make sure public interface takes public types as params
This commit exports and renames the following variable names:
- `PendingInput` is now `PendingInputResponse` as it's responding to a
  request.
- `pendingInput` is now renamed and exported as `SweeperInput`.
- `pendingInputs` is now renamed and exported as `InputsMap`.

This commit is first made from running:
```
gofmt -d -w -r 'PendingInput -> PendingInputResponse' .
gofmt -d -w -r 'pendingInput -> SweeperInput' .
gofmt -d -w -r 'pendingInputs -> InputsMap' .
```
And followed by some docs and variable names fixes.
2024-04-19 21:33:30 +08:00
yyforyongyu
90e727a776
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.
2024-04-19 21:33:29 +08:00
yyforyongyu
11f7e455d1
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.
2024-04-19 21:33:29 +08:00
yyforyongyu
f85661d94a
lnwallet+sweep: add new method CheckMempoolAcceptance 2024-04-19 21:33:28 +08:00
yyforyongyu
1187b868ad
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.
2024-04-19 21:33:27 +08:00
yyforyongyu
db7eae97ff
sweep: expand InputSet with more interface methods
This commit adds more interface methods to `InputSet` to prepare the
addition of budget-based aggregator.
2024-04-19 21:33:27 +08:00
yyforyongyu
c03509397f
sweep: add mocks and patch unit test for sweepPendingInputs 2024-04-19 21:33:26 +08:00
yyforyongyu
210b7838c7
sweep: move mocks into one file 2024-04-19 21:33:25 +08:00