Skip to content

Commit 08d5428

Browse files
MarcoFalkePastaPastaPasta
MarcoFalke
authored andcommitted
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
1 parent 2660c97 commit 08d5428

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/rpc/client.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ static const CRPCConvertParam vRPCConvertParams[] =
111111
{ "signrawtransactionwithkey", 1, "privkeys" },
112112
{ "signrawtransactionwithkey", 2, "prevtxs" },
113113
{ "signrawtransactionwithwallet", 1, "prevtxs" },
114-
{ "sendrawtransaction", 1, "allowhighfees" },
115114
{ "sendrawtransaction", 1, "maxfeerate" },
116115
{ "sendrawtransaction", 2, "instantsend" },
117116
{ "sendrawtransaction", 3, "bypasslimits" },
118117
{ "testmempoolaccept", 0, "rawtxs" },
119-
{ "testmempoolaccept", 1, "allowhighfees" },
120118
{ "testmempoolaccept", 1, "maxfeerate" },
121119
{ "combinerawtransaction", 0, "txs" },
122120
{ "fundrawtransaction", 1, "options" },

src/rpc/rawtransaction.cpp

+10-18
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
819819

820820
RPCTypeCheck(request.params, {
821821
UniValue::VSTR,
822-
UniValueType(), // NUM or BOOL, checked later
822+
UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
823823
UniValue::VBOOL
824824
});
825825

@@ -829,13 +829,9 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
829829
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
830830
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
831831

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

840836
int64_t virtual_size = GetVirtualTransactionSize(*tx);
841837
CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee(virtual_size);
@@ -893,7 +889,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
893889

894890
RPCTypeCheck(request.params, {
895891
UniValue::VARR,
896-
UniValueType(), // NUM or BOOL, checked later
892+
UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
897893
});
898894

899895
if (request.params[0].get_array().size() != 1) {
@@ -907,13 +903,9 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
907903
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
908904
const uint256& tx_hash = tx->GetHash();
909905

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

918910
int64_t virtual_size = GetVirtualTransactionSize(*tx);
919911
CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee(virtual_size);
@@ -1693,10 +1685,10 @@ static const CRPCCommand commands[] =
16931685
{ "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime"} },
16941686
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, {"hexstring"} },
16951687
{ "rawtransactions", "decodescript", &decodescript, {"hexstring"} },
1696-
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","allowhighfees|maxfeerate","instantsend","bypasslimits"} },
1688+
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","maxfeerate","instantsend","bypasslimits"} },
16971689
{ "rawtransactions", "combinerawtransaction", &combinerawtransaction, {"txs"} },
16981690
{ "rawtransactions", "signrawtransactionwithkey", &signrawtransactionwithkey, {"hexstring","privkeys","prevtxs","sighashtype"} },
1699-
{ "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","allowhighfees|maxfeerate"} },
1691+
{ "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","maxfeerate"} },
17001692
{ "rawtransactions", "decodepsbt", &decodepsbt, {"psbt"} },
17011693
{ "rawtransactions", "combinepsbt", &combinepsbt, {"txs"} },
17021694
{ "rawtransactions", "finalizepsbt", &finalizepsbt, {"psbt", "extract"} },

0 commit comments

Comments
 (0)