Skip to content

Commit

Permalink
Interpret maxfeerate parameter and default fallback in reference fee …
Browse files Browse the repository at this point in the history
…unit for sendrawtransaction
  • Loading branch information
JBetz committed Apr 23, 2024
1 parent 41c280a commit 08ec63e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ static RPCHelpMan sendrawtransaction()
DEFAULT_MAX_RAW_TX_FEE_RATE :
CFeeRate(AmountFromValue(request.params[1]));

CAsset feeAsset = ::policyAsset;
for (const auto& out : tx->vout) {
// If we have a nonce, it could be a smuggled pubkey, or it could be a
// proper nonce produced by blinding. In the latter case, the value
Expand All @@ -975,10 +976,13 @@ static RPCHelpMan sendrawtransaction()
if (!out.nNonce.IsNull() && out.nValue.IsExplicit()) {
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Transaction output has nonce, but is not blinded. Did you forget to call blindrawtransaction, or rawblindrawtransaction?");
}
if (out.IsFee()) {
feeAsset = out.nAsset.GetAsset();
}
}

int64_t virtual_size = GetVirtualTransactionSize(*tx);
CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee(virtual_size);
CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee(virtual_size, feeAsset);

std::string err_string;
AssertLockNotHeld(cs_main);
Expand Down

0 comments on commit 08ec63e

Please sign in to comment.