mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 04:52:36 +02:00
RPC: sendrawtransaction: Replace boolean allowhighfees with an Array of rejections to ignore (in a backward compatible manner)
This commit is contained in:
parent
99f70a4af3
commit
b4f6e44d2c
@ -119,6 +119,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
||||
{ "signrawtransactionwithwallet", 1, "prevtxs" },
|
||||
{ "sendrawtransaction", 1, "maxfeerate" },
|
||||
{ "sendrawtransaction", 2, "maxburnamount" },
|
||||
{ "sendrawtransaction", 3, "ignore_rejects" },
|
||||
{ "testmempoolaccept", 0, "rawtxs" },
|
||||
{ "testmempoolaccept", 1, "maxfeerate" },
|
||||
{ "submitpackage", 0, "package" },
|
||||
|
@ -50,6 +50,11 @@ static RPCHelpMan sendrawtransaction()
|
||||
"Reject transactions with provably unspendable outputs (e.g. 'datacarrier' outputs that use the OP_RETURN opcode) greater than the specified value, expressed in " + CURRENCY_UNIT + ".\n"
|
||||
"If burning funds through unspendable outputs is desired, increase this value.\n"
|
||||
"This check is based on heuristics and does not guarantee spendability of outputs.\n"},
|
||||
{"ignore_rejects", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Rejection conditions to ignore, eg 'txn-mempool-conflict'",
|
||||
{
|
||||
{"reject_reason", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
|
||||
},
|
||||
},
|
||||
},
|
||||
RPCResult{
|
||||
RPCResult::Type::STR_HEX, "", "The transaction hash in hex"
|
||||
@ -81,15 +86,25 @@ static RPCHelpMan sendrawtransaction()
|
||||
|
||||
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
|
||||
|
||||
const UniValue* json_ign_rejs = &request.params[3];
|
||||
|
||||
const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ?
|
||||
DEFAULT_MAX_RAW_TX_FEE_RATE :
|
||||
CFeeRate(AmountFromValue(request.params[1]));
|
||||
|
||||
|
||||
ignore_rejects_type ignore_rejects;
|
||||
if (!json_ign_rejs->isNull()) {
|
||||
for (size_t i = 0; i < json_ign_rejs->size(); ++i) {
|
||||
const UniValue& json_ign_rej = (*json_ign_rejs)[i];
|
||||
ignore_rejects.insert(json_ign_rej.get_str());
|
||||
}
|
||||
}
|
||||
|
||||
std::string err_string;
|
||||
AssertLockNotHeld(cs_main);
|
||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
const TransactionError err = BroadcastTransaction(node, tx, err_string, max_raw_tx_fee_rate, /*relay=*/true, /*wait_callback=*/true);
|
||||
const TransactionError err = BroadcastTransaction(node, tx, err_string, max_raw_tx_fee_rate, /*relay=*/true, /*wait_callback=*/true, ignore_rejects);
|
||||
if (TransactionError::OK != err) {
|
||||
throw JSONRPCTransactionError(err, err_string);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user