Skip to content

Commit c0fc7cb

Browse files
committed
Merge #321: Add comment clarifying fee rate in FundRawTransactionOptions
f8a1622 Add comment clarifying fee rate in FundRawTransactionOptions (Casey Rodarmor) Pull request description: 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](https://developer.bitcoin.org/reference/rpc/fundrawtransaction.html): ``` "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. ACKs for top commit: tcharding: ACK f8a1622 Tree-SHA512: 3ec1c4d5dcce51b3f14cc4825667c4fda29b818dbc9b4aa8bc5d909bdaa547d5d19f78a32b2bd406f67a5344ee0574ebcbd239a7301532fb7685b1bfd2b6dc5b
2 parents 4b3ac19 + f8a1622 commit c0fc7cb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

json/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,9 @@ pub struct FundRawTransactionOptions {
18771877
pub include_watching: Option<bool>,
18781878
#[serde(skip_serializing_if = "Option::is_none")]
18791879
pub lock_unspents: Option<bool>,
1880+
/// The fee rate to pay per kvB. NB. This field is converted to camelCase
1881+
/// when serialized, so it is receeived by fundrawtransaction as `feeRate`,
1882+
/// which fee rate per kvB, and *not* `fee_rate`, which is per vB.
18801883
#[serde(
18811884
with = "bitcoin::amount::serde::as_btc::opt",
18821885
skip_serializing_if = "Option::is_none"

0 commit comments

Comments
 (0)