Skip to content

sendrawtransaction maxfeerate is interpreted as absolute fee by default #16382

@maflcko

Description

@maflcko

When the newly introduced "maxfeerate" option is not passed, the default fee rate is interpreted as an absolute amount. However, when it is passed, it is interpreted as a fee rate. Thus, the rpc will return different results when the value is explicitly set to the default.

See

CAmount max_raw_tx_fee = DEFAULT_MAX_RAW_TX_FEE;
// TODO: temporary migration code for old clients. Remove in v0.20
if (request.params[1].isBool()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.");
} else if (!request.params[1].isNull()) {
size_t weight = GetTransactionWeight(*tx);
CFeeRate fr(AmountFromValue(request.params[1]));
// the +3/4 part rounds the value up, and is the same formula used when
// calculating the fee for a transaction
// (see GetVirtualTransactionSize)
max_raw_tx_fee = fr.GetFee((weight+3)/4);

I think we should change it back to an absolute value in BTC (not a feerate)

This was changed to a feerate by @kallewoof, so ping him to see if there was a specific reason to switch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions