Skip to content

Commit 76143bf

Browse files
author
MarcoFalke
committed
Merge #18495: rpc: Remove deprecated migration code
2599d13 rpc: Remove deprecated migration code (Vasil Dimov) Pull request description: Don't accept a second argument to `sendrawtransaction` and `testmempoolaccept` of type `bool`. Actually even the code before this change would not accept `bool`, but it would print a long explanatory message when rejecting it: "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0." This was scheduled for removal in 6c0a6f7. ACKs for top commit: MarcoFalke: ACK 2599d13 📅 Tree-SHA512: e2c74c0bde88e20149d0deab0845851bb3979143530a6bae4f46769d61b607ad2e2347f8969093c2461a80c47661732dc0b3def140f8ce84081719adda3b3811
2 parents ed3b8ea + 2599d13 commit 76143bf

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/rpc/client.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ static const CRPCConvertParam vRPCConvertParams[] =
9898
{ "signrawtransactionwithkey", 1, "privkeys" },
9999
{ "signrawtransactionwithkey", 2, "prevtxs" },
100100
{ "signrawtransactionwithwallet", 1, "prevtxs" },
101-
{ "sendrawtransaction", 1, "allowhighfees" },
102101
{ "sendrawtransaction", 1, "maxfeerate" },
103102
{ "testmempoolaccept", 0, "rawtxs" },
104-
{ "testmempoolaccept", 1, "allowhighfees" },
105103
{ "testmempoolaccept", 1, "maxfeerate" },
106104
{ "combinerawtransaction", 0, "txs" },
107105
{ "fundrawtransaction", 1, "options" },

src/rpc/rawtransaction.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
825825

826826
RPCTypeCheck(request.params, {
827827
UniValue::VSTR,
828-
UniValueType(), // NUM or BOOL, checked later
828+
UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
829829
});
830830

831831
// parse hex string from parameter
@@ -834,13 +834,9 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
834834
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
835835
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
836836

837-
CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE;
838-
// TODO: temporary migration code for old clients. Remove in v0.20
839-
if (request.params[1].isBool()) {
840-
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.");
841-
} else if (!request.params[1].isNull()) {
842-
max_raw_tx_fee_rate = CFeeRate(AmountFromValue(request.params[1]));
843-
}
837+
const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ?
838+
DEFAULT_MAX_RAW_TX_FEE_RATE :
839+
CFeeRate(AmountFromValue(request.params[1]));
844840

845841
int64_t virtual_size = GetVirtualTransactionSize(*tx);
846842
CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee(virtual_size);
@@ -896,7 +892,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
896892

897893
RPCTypeCheck(request.params, {
898894
UniValue::VARR,
899-
UniValueType(), // NUM or BOOL, checked later
895+
UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
900896
});
901897

902898
if (request.params[0].get_array().size() != 1) {
@@ -910,13 +906,9 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
910906
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
911907
const uint256& tx_hash = tx->GetHash();
912908

913-
CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE;
914-
// TODO: temporary migration code for old clients. Remove in v0.20
915-
if (request.params[1].isBool()) {
916-
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.");
917-
} else if (!request.params[1].isNull()) {
918-
max_raw_tx_fee_rate = CFeeRate(AmountFromValue(request.params[1]));
919-
}
909+
const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ?
910+
DEFAULT_MAX_RAW_TX_FEE_RATE :
911+
CFeeRate(AmountFromValue(request.params[1]));
920912

921913
CTxMemPool& mempool = EnsureMemPool();
922914
int64_t virtual_size = GetVirtualTransactionSize(*tx);
@@ -1823,10 +1815,10 @@ static const CRPCCommand commands[] =
18231815
{ "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime","replaceable"} },
18241816
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, {"hexstring","iswitness"} },
18251817
{ "rawtransactions", "decodescript", &decodescript, {"hexstring"} },
1826-
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","allowhighfees|maxfeerate"} },
1818+
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","maxfeerate"} },
18271819
{ "rawtransactions", "combinerawtransaction", &combinerawtransaction, {"txs"} },
18281820
{ "rawtransactions", "signrawtransactionwithkey", &signrawtransactionwithkey, {"hexstring","privkeys","prevtxs","sighashtype"} },
1829-
{ "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","allowhighfees|maxfeerate"} },
1821+
{ "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","maxfeerate"} },
18301822
{ "rawtransactions", "decodepsbt", &decodepsbt, {"psbt"} },
18311823
{ "rawtransactions", "combinepsbt", &combinepsbt, {"txs"} },
18321824
{ "rawtransactions", "finalizepsbt", &finalizepsbt, {"psbt", "extract"} },

0 commit comments

Comments
 (0)