Merge #18495: rpc: Remove deprecated migration code

2599d13c94 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 6c0a6f73e.

ACKs for top commit:
  MarcoFalke:
    ACK 2599d13c94 📅

Tree-SHA512: e2c74c0bde88e20149d0deab0845851bb3979143530a6bae4f46769d61b607ad2e2347f8969093c2461a80c47661732dc0b3def140f8ce84081719adda3b3811
pull/18609/head
MarcoFalke 5 years ago
commit 76143bf714
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -98,10 +98,8 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "signrawtransactionwithkey", 1, "privkeys" }, { "signrawtransactionwithkey", 1, "privkeys" },
{ "signrawtransactionwithkey", 2, "prevtxs" }, { "signrawtransactionwithkey", 2, "prevtxs" },
{ "signrawtransactionwithwallet", 1, "prevtxs" }, { "signrawtransactionwithwallet", 1, "prevtxs" },
{ "sendrawtransaction", 1, "allowhighfees" },
{ "sendrawtransaction", 1, "maxfeerate" }, { "sendrawtransaction", 1, "maxfeerate" },
{ "testmempoolaccept", 0, "rawtxs" }, { "testmempoolaccept", 0, "rawtxs" },
{ "testmempoolaccept", 1, "allowhighfees" },
{ "testmempoolaccept", 1, "maxfeerate" }, { "testmempoolaccept", 1, "maxfeerate" },
{ "combinerawtransaction", 0, "txs" }, { "combinerawtransaction", 0, "txs" },
{ "fundrawtransaction", 1, "options" }, { "fundrawtransaction", 1, "options" },

@ -825,7 +825,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
RPCTypeCheck(request.params, { RPCTypeCheck(request.params, {
UniValue::VSTR, UniValue::VSTR,
UniValueType(), // NUM or BOOL, checked later UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
}); });
// parse hex string from parameter // parse hex string from parameter
@ -834,13 +834,9 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
CTransactionRef tx(MakeTransactionRef(std::move(mtx))); CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE; const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ?
// TODO: temporary migration code for old clients. Remove in v0.20 DEFAULT_MAX_RAW_TX_FEE_RATE :
if (request.params[1].isBool()) { CFeeRate(AmountFromValue(request.params[1]));
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.");
} else if (!request.params[1].isNull()) {
max_raw_tx_fee_rate = CFeeRate(AmountFromValue(request.params[1]));
}
int64_t virtual_size = GetVirtualTransactionSize(*tx); 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);
@ -896,7 +892,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
RPCTypeCheck(request.params, { RPCTypeCheck(request.params, {
UniValue::VARR, UniValue::VARR,
UniValueType(), // NUM or BOOL, checked later UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
}); });
if (request.params[0].get_array().size() != 1) { if (request.params[0].get_array().size() != 1) {
@ -910,13 +906,9 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
CTransactionRef tx(MakeTransactionRef(std::move(mtx))); CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
const uint256& tx_hash = tx->GetHash(); const uint256& tx_hash = tx->GetHash();
CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE; const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ?
// TODO: temporary migration code for old clients. Remove in v0.20 DEFAULT_MAX_RAW_TX_FEE_RATE :
if (request.params[1].isBool()) { CFeeRate(AmountFromValue(request.params[1]));
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.");
} else if (!request.params[1].isNull()) {
max_raw_tx_fee_rate = CFeeRate(AmountFromValue(request.params[1]));
}
CTxMemPool& mempool = EnsureMemPool(); CTxMemPool& mempool = EnsureMemPool();
int64_t virtual_size = GetVirtualTransactionSize(*tx); int64_t virtual_size = GetVirtualTransactionSize(*tx);
@ -1823,10 +1815,10 @@ static const CRPCCommand commands[] =
{ "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime","replaceable"} }, { "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime","replaceable"} },
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, {"hexstring","iswitness"} }, { "rawtransactions", "decoderawtransaction", &decoderawtransaction, {"hexstring","iswitness"} },
{ "rawtransactions", "decodescript", &decodescript, {"hexstring"} }, { "rawtransactions", "decodescript", &decodescript, {"hexstring"} },
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","allowhighfees|maxfeerate"} }, { "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","maxfeerate"} },
{ "rawtransactions", "combinerawtransaction", &combinerawtransaction, {"txs"} }, { "rawtransactions", "combinerawtransaction", &combinerawtransaction, {"txs"} },
{ "rawtransactions", "signrawtransactionwithkey", &signrawtransactionwithkey, {"hexstring","privkeys","prevtxs","sighashtype"} }, { "rawtransactions", "signrawtransactionwithkey", &signrawtransactionwithkey, {"hexstring","privkeys","prevtxs","sighashtype"} },
{ "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","allowhighfees|maxfeerate"} }, { "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","maxfeerate"} },
{ "rawtransactions", "decodepsbt", &decodepsbt, {"psbt"} }, { "rawtransactions", "decodepsbt", &decodepsbt, {"psbt"} },
{ "rawtransactions", "combinepsbt", &combinepsbt, {"txs"} }, { "rawtransactions", "combinepsbt", &combinepsbt, {"txs"} },
{ "rawtransactions", "finalizepsbt", &finalizepsbt, {"psbt", "extract"} }, { "rawtransactions", "finalizepsbt", &finalizepsbt, {"psbt", "extract"} },

Loading…
Cancel
Save