lnrpc+sweep: rename Force to Immediate for clarity

This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:37 +08:00
1 parent 19a599a1a9
commit db3aad31aa
9 files changed
+484 -435

No files matched your search

+12 -13
View File
@@ -48,12 +48,6 @@ type Params struct {
// a fee rate whenever we attempt to cluster inputs for a sweep.
Fee FeePreference
// Force indicates whether the input should be swept regardless of
// whether it is economical to do so.
//
// TODO(yy): Remove this param once deadline based sweeping is in place.
Force bool
// ExclusiveGroup is an identifier that, if set, prevents other inputs
// with the same identifier from being batched together.
ExclusiveGroup *uint64
@@ -66,6 +60,11 @@ type Params struct {
// Budget specifies the maximum amount of satoshis that can be spent on
// fees for this sweep.
Budget btcutil.Amount
// Immediate indicates that the input should be swept immediately
// without waiting for blocks to come to trigger the sweeping of
// inputs.
Immediate bool
}
// ParamsUpdate contains a new set of parameters to update a pending sweep with.
@@ -75,9 +74,9 @@ type ParamsUpdate struct {
// a fee rate whenever we attempt to cluster inputs for a sweep.
Fee FeePreference
// Force indicates whether the input should be swept regardless of
// whether it is economical to do so.
Force bool
// Immediate indicates that the input should be swept immediately
// without waiting for blocks to come.
Immediate bool
}
// String returns a human readable interpretation of the sweep parameters.
@@ -92,8 +91,8 @@ func (p Params) String() string {
exclusiveGroup = fmt.Sprintf("%d", *p.ExclusiveGroup)
}
return fmt.Sprintf("fee=%v, force=%v, exclusive_group=%v, budget=%v, "+
"deadline=%v", p.Fee, p.Force, exclusiveGroup, p.Budget,
return fmt.Sprintf("fee=%v, immediate=%v, exclusive_group=%v, budget=%v, "+
"deadline=%v", p.Fee, p.Immediate, exclusiveGroup, p.Budget,
deadline)
}
@@ -669,7 +668,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
// If this input is forced, we perform an sweep
// immediately.
if input.params.Force {
if input.params.Immediate {
inputs := s.updateSweeperInputs()
s.sweepPendingInputs(inputs)
}
@@ -1144,7 +1143,7 @@ func (s *UtxoSweeper) handleUpdateReq(req *updateReq) (
// unchanged.
newParams := sweeperInput.params
newParams.Fee = req.params.Fee
newParams.Force = req.params.Force
newParams.Immediate = req.params.Immediate
log.Debugf("Updating parameters for %v(state=%v) from (%v) to (%v)",
req.input, sweeperInput.state, sweeperInput.params, newParams)