Add fee rate constructors that take Amount as arg - #4614
Merged
apoelstra merged 2 commits intoJun 12, 2025
Merged
Conversation
Satoshis per virtual byte is grammatically better than satoshis per virtual bytes - I think.
Some users may find it more ergonomic to pass in an `Amount` when constructing fee rates. Also the strong type adds some semantic meaning as well as imposes the `Amount::MAX` limit. Add an equivalent constructor for each of the existing ones that uses an argument of type `Amount` instead of `u64` sats.
This was referenced Jun 12, 2025
Contributor
|
I went looking for #4734 to try and understand why this PR is useful but it doesn't exist. Why is Amount to FeeRate useful exactly? |
Member
|
Because feerates are defined in terms of amounts. |
Contributor
|
true, it's a ratio of amount/weight (sat/wu). Although I haven't run into a situation where it's useful to go from amount to fee_rate. Why not from Weight to fee_rate then also? |
Contributor
|
To me, fee is defined in terms of amounts. |
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.
Some users may find it more ergonomic to pass in an
Amountwhen constructing fee rates. Also the strong type adds some semantic meaning as well as imposes theAmount::MAXlimit.Add an equivalent constructor for each of the existing ones that uses an argument of type
Amountinstead ofu64sats.(This was pulled out of #4610.)
Close: #4734