fee_policy: don't quantize explicitly set feerates - #10912
Merged
Merged
Conversation
When a feerate is set explicitly (CLI --feerate, or a 'feerate:' fee_policy descriptor), estimate_fee() would round it to FEERATE_PRECISION (one decimal place, half-down) before computing the fee. So e.g. 'payto ... --feerate 0.45' paid 0.4 sat/vB, and '--feerate 3.75' paid 3.7, without any indication that the requested rate was not used. The quantization exists to keep the paid fee consistent with the feerate displayed in the GUI (dynamic estimates are shown rounded to one decimal place). That reasoning does not apply to FeeMethod.FEERATE: both GUIs already quantize/validate user feerate input before the policy is constructed (FeerateEdit._get_amount_from_text in Qt, a one-decimal RegularExpressionValidator in QML FeePicker), so for GUI-originated policies the quantization was a no-op; it only changed rates coming from the CLI or a config descriptor. ETA and mempool based estimates keep being quantized.
Contributor
Author
|
Tested on mainnet: |
Member
|
lgtm 44c9c47, thanks for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
estimate_fee()rounds the feerate toFEERATE_PRECISION(1 decimal place, half-down) before computing the fee, sopayto --feerate 0.45pays 0.4 sat/vB and--feerate 3.75(the example from #4259) pays 3.7, with no indication that the requested rate was not used.The rounding was added in f12798e for consistency with the GUI display, but both GUIs already constrain feerate input to one decimal place before the policy is constructed, so for
FeeMethod.FEERATEit only affected CLI- andconfig-originated rates. ETA and mempool based estimates keep being quantized. Since 58af1c4 lowered the supported relay floor to 0.1 sat/vB, one-decimal granularity is coarsest exactly where these rates now live.
Note:
bump_fee/dscancelhave their ownquantize_feeratecall (which also feeds the new-vs-old rate sanity check); deliberately left untouched here.