Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment clarifying fee rate in FundRawTransactionOptions #321

Merged

Conversation

casey
Copy link
Contributor

@casey casey commented Nov 28, 2023

I think this is potentially a bit of a footgun and deserves some clarification.

fundrawtransaction has two different ways to specify fee rate, fee_rate, and feeRate. From the docs:

"fee_rate" -  Specify a fee rate in sat/vB.
"feeRate" - Specify a fee rate in BTC/kvB.

This is extra confusing because the field in FundRawTransactionOptions is called fee_rate, but is serde renamed to camelCase, so becomes feeRate.

This PR adds a comment to FundRawTransactionOptions::fee_rate clarifying that it's in kvB and not vB, and corresponds to the feeRate argument to fundrawtransaction.

I actually think it would it would probably be best if the rust field were renamed to fee_rate_per_kvb, and manually renamed to feeRate when serializing, but this is good quick fix.

@apoelstra
Copy link
Member

See also #320 which suggests a type-level fix.

@casey
Copy link
Contributor Author

casey commented Nov 28, 2023

I think the type level fix is way better, although this could be merged in the mean time. Although it's only really useful if it makes it into a release sooner than the type level fix.

@tcharding
Copy link
Member

I'm going to merge this, its docs only and documents a know problem. FTR after recently being made a maintainer here in this crate I am going to attempt to put some work into the crate and get a bunch of things into a new release soon-ish. Merging this PR will be a test run of my permissions to do so.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f8a1622

@tcharding tcharding merged commit c0fc7cb into rust-bitcoin:master Apr 30, 2024
10 checks passed
@tcharding
Copy link
Member

BOOM!

@casey casey deleted the clarify-fundrawtransaction-fee-rate branch April 30, 2024 22:04
@casey
Copy link
Contributor Author

casey commented Apr 30, 2024

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants