Skip to content

Commit f80c8a5

Browse files
committed
RPC: sendrawtransaction: Replace boolean allowhighfees with an Array of rejections to ignore (in a backward compatible manner)
1 parent cd1b140 commit f80c8a5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/rpc/client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
125125
{ "signrawtransactionwithwallet", 1, "prevtxs" },
126126
{ "sendrawtransaction", 1, "maxfeerate" },
127127
{ "sendrawtransaction", 2, "maxburnamount" },
128+
{ "sendrawtransaction", 3, "ignore_rejects" },
128129
{ "testmempoolaccept", 0, "rawtxs" },
129130
{ "testmempoolaccept", 1, "maxfeerate" },
130131
{ "submitpackage", 0, "package" },

src/rpc/mempool.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ static RPCHelpMan sendrawtransaction()
5454
"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"
5555
"If burning funds through unspendable outputs is desired, increase this value.\n"
5656
"This check is based on heuristics and does not guarantee spendability of outputs.\n"},
57+
{"ignore_rejects", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Rejection conditions to ignore, eg 'txn-mempool-conflict'",
58+
{
59+
{"reject_reason", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
60+
},
61+
},
5762
},
5863
RPCResult{
5964
RPCResult::Type::STR_HEX, "", "The transaction hash in hex"
@@ -85,12 +90,22 @@ static RPCHelpMan sendrawtransaction()
8590

8691
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
8792

93+
const UniValue* json_ign_rejs = &request.params[3];
94+
8895
const CFeeRate max_raw_tx_fee_rate{ParseFeeRate(self.Arg<UniValue>("maxfeerate"))};
8996

97+
ignore_rejects_type ignore_rejects;
98+
if (!json_ign_rejs->isNull()) {
99+
for (size_t i = 0; i < json_ign_rejs->size(); ++i) {
100+
const UniValue& json_ign_rej = (*json_ign_rejs)[i];
101+
ignore_rejects.insert(json_ign_rej.get_str());
102+
}
103+
}
104+
90105
std::string err_string;
91106
AssertLockNotHeld(cs_main);
92107
NodeContext& node = EnsureAnyNodeContext(request.context);
93-
const TransactionError err = BroadcastTransaction(node, tx, err_string, max_raw_tx_fee_rate, /*relay=*/true, /*wait_callback=*/true);
108+
const TransactionError err = BroadcastTransaction(node, tx, err_string, max_raw_tx_fee_rate, /*relay=*/true, /*wait_callback=*/true, ignore_rejects);
94109
if (TransactionError::OK != err) {
95110
throw JSONRPCTransactionError(err, err_string);
96111
}

0 commit comments

Comments
 (0)