walletrpc+sweep: refactor BumpFee to properly handle sweep request

This commit is contained in:
yyforyongyu
2024-04-11 17:08:50 +08:00
parent 94159e8950
commit 8804947179
3 changed files with 204 additions and 79 deletions

View File

@@ -1087,14 +1087,6 @@ func (s *UtxoSweeper) handlePendingSweepsReq(
func (s *UtxoSweeper) UpdateParams(input wire.OutPoint,
params Params) (chan Result, error) {
// Ensure the client provided a sane fee preference.
_, err := params.Fee.Estimate(
s.cfg.FeeEstimator, s.cfg.MaxFeeRate.FeePerKWeight(),
)
if err != nil {
return nil, err
}
responseChan := make(chan *updateResp, 1)
select {
case s.updateReqs <- &updateReq{
@@ -1140,9 +1132,14 @@ func (s *UtxoSweeper) handleUpdateReq(req *updateReq) (
// Create the updated parameters struct. Leave the exclusive group
// unchanged.
newParams := sweeperInput.params
newParams.Fee = req.params.Fee
newParams.Immediate = req.params.Immediate
newParams := Params{
Fee: req.params.Fee,
StartingFeeRate: req.params.StartingFeeRate,
Immediate: req.params.Immediate,
Budget: req.params.Budget,
DeadlineHeight: req.params.DeadlineHeight,
ExclusiveGroup: sweeperInput.params.ExclusiveGroup,
}
log.Debugf("Updating parameters for %v(state=%v) from (%v) to (%v)",
req.input, sweeperInput.state, sweeperInput.params, newParams)