Skip to content

Commit 7e04a9a

Browse files
laanwjPastaPastaPasta
authored andcommitted
Merge bitcoin#12336: Remove deprecated rpc options
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
1 parent 0ad89ac commit 7e04a9a

File tree

6 files changed

+85
-167
lines changed

6 files changed

+85
-167
lines changed

src/rpc/client.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
137137
{ "pruneblockchain", 0, "height" },
138138
{ "keypoolrefill", 0, "newsize" },
139139
{ "getrawmempool", 0, "verbose" },
140-
{ "estimatefee", 0, "nblocks" },
141140
{ "estimatesmartfee", 0, "conf_target" },
142141
{ "estimaterawfee", 0, "conf_target" },
143142
{ "estimaterawfee", 1, "threshold" },

src/rpc/mining.cpp

+4-43
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ UniValue getmininginfo(const JSONRPCRequest& request)
213213
" \"pooledtx\": n (numeric) The size of the mempool\n"
214214
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
215215
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
216-
" \"errors\": \"...\" (string) DEPRECATED. Same as warnings. Only shown when dashd is started with -deprecatedrpc=getmininginfo\n"
217216
"}\n"
218217
"\nExamples:\n"
219218
+ HelpExampleCli("getmininginfo", "")
@@ -231,11 +230,7 @@ UniValue getmininginfo(const JSONRPCRequest& request)
231230
obj.push_back(Pair("networkhashps", getnetworkhashps(request)));
232231
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
233232
obj.push_back(Pair("chain", Params().NetworkIDString()));
234-
if (IsDeprecatedRPCEnabled("getmininginfo")) {
235-
obj.push_back(Pair("errors", GetWarnings("statusbar")));
236-
} else {
237-
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
238-
}
233+
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
239234
return obj;
240235
}
241236

@@ -799,42 +794,8 @@ UniValue submitblock(const JSONRPCRequest& request)
799794

800795
UniValue estimatefee(const JSONRPCRequest& request)
801796
{
802-
if (request.fHelp || request.params.size() != 1)
803-
throw std::runtime_error(
804-
"estimatefee nblocks\n"
805-
"\nDEPRECATED. Please use estimatesmartfee for more intelligent estimates."
806-
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
807-
"confirmation within nblocks blocks.\n"
808-
"\nArguments:\n"
809-
"1. nblocks (numeric, required)\n"
810-
"\nResult:\n"
811-
"n (numeric) estimated fee-per-kilobyte\n"
812-
"\n"
813-
"A negative value is returned if not enough transactions and blocks\n"
814-
"have been observed to make an estimate.\n"
815-
"-1 is always returned for nblocks == 1 as it is impossible to calculate\n"
816-
"a fee that is high enough to get reliably included in the next block.\n"
817-
"\nExample:\n"
818-
+ HelpExampleCli("estimatefee", "6")
819-
);
820-
821-
if (!IsDeprecatedRPCEnabled("estimatefee")) {
822-
throw JSONRPCError(RPC_METHOD_DEPRECATED, "estimatefee is deprecated and will be fully removed in v0.17. "
823-
"To use estimatefee in v0.16, restart dashd with -deprecatedrpc=estimatefee.\n"
824-
"Projects should transition to using estimatesmartfee before upgrading to v0.17");
825-
}
826-
827-
RPCTypeCheck(request.params, {UniValue::VNUM});
828-
829-
int nBlocks = request.params[0].get_int();
830-
if (nBlocks < 1)
831-
nBlocks = 1;
832-
833-
CFeeRate feeRate = ::feeEstimator.estimateFee(nBlocks);
834-
if (feeRate == CFeeRate(0))
835-
return -1.0;
836-
837-
return ValueFromAmount(feeRate.GetFeePerK());
797+
throw JSONRPCError(RPC_METHOD_DEPRECATED, "estimatefee was removed in v0.17.\n"
798+
"Clients should use estimatesmartfee.");
838799
}
839800

840801
UniValue estimatesmartfee(const JSONRPCRequest& request)
@@ -1011,7 +972,7 @@ static const CRPCCommand commands[] =
1011972
{ "generating", "generatetoaddress", &generatetoaddress, {"nblocks","address","maxtries"} },
1012973
#endif // ENABLE_MINER
1013974

1014-
{ "util", "estimatefee", &estimatefee, {"nblocks"} },
975+
{ "hidden", "estimatefee", &estimatefee, {} },
1015976
{ "util", "estimatesmartfee", &estimatesmartfee, {"conf_target", "estimate_mode"} },
1016977

1017978
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },

src/rpc/misc.cpp

+1-11
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ UniValue createmultisig(const JSONRPCRequest& request)
343343
std::string msg = "createmultisig nrequired [\"key\",...]\n"
344344
"\nCreates a multi-signature address with n signature of m keys required.\n"
345345
"It returns a json object with the address and redeemScript.\n"
346-
"DEPRECATION WARNING: Using addresses with createmultisig is deprecated. Clients must\n"
347-
"transition to using addmultisigaddress to create multisig addresses with addresses known\n"
348-
"to the wallet before upgrading to v0.17. To use the deprecated functionality, start dashd with -deprecatedrpc=createmultisig\n"
349346
"\nArguments:\n"
350347
"1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
351348
"2. \"keys\" (string, required) A json array of hex-encoded public keys\n"
@@ -378,15 +375,8 @@ UniValue createmultisig(const JSONRPCRequest& request)
378375
if (IsHex(keys[i].get_str()) && (keys[i].get_str().length() == 66 || keys[i].get_str().length() == 130)) {
379376
pubkeys.push_back(HexToPubKey(keys[i].get_str()));
380377
} else {
381-
#ifdef ENABLE_WALLET
382-
CWallet* const pwallet = GetWalletForJSONRPCRequest(request);
383-
if (IsDeprecatedRPCEnabled("createmultisig") && EnsureWalletIsAvailable(pwallet, false)) {
384-
pubkeys.push_back(AddrToPubKey(pwallet, keys[i].get_str()));
385-
} else
386-
#endif
387378
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid public key: %s\nNote that from v0.16, createmultisig no longer accepts addresses."
388-
" Clients must transition to using addmultisigaddress to create multisig addresses with addresses known to the wallet before upgrading to v0.17."
389-
" To use the deprecated functionality, start dashd with -deprecatedrpc=createmultisig", keys[i].get_str()));
379+
" Users must use addmultisigaddress to create multisig addresses with addresses known to the wallet.", keys[i].get_str()));
390380
}
391381
}
392382

src/wallet/rpcwallet.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -1235,10 +1235,6 @@ UniValue addmultisigaddress(const JSONRPCRequest& request)
12351235
" \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n"
12361236
" \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
12371237
"}\n"
1238-
"\nResult (DEPRECATED. To see this result in v0.16 instead, please start dashd with -deprecatedrpc=addmultisigaddress).\n"
1239-
" clients should transition to the new output api before upgrading to v0.17.\n"
1240-
"\"address\" (string) A dash address associated with the keys.\n"
1241-
12421238
"\nExamples:\n"
12431239
"\nAdd a multisig address from 2 addresses\n"
12441240
+ HelpExampleCli("addmultisigaddress", "2 \"[\\\"Xt4qk9uKvQYAonVGSZNXqxeDmtjaEWgfrS\\\",\\\"XoSoWQkpgLpppPoyyzbUFh1fq2RBvW6UK2\\\"]\"") +
@@ -1274,11 +1270,6 @@ UniValue addmultisigaddress(const JSONRPCRequest& request)
12741270

12751271
pwallet->SetAddressBook(innerID, strAccount, "send");
12761272

1277-
// Return old style interface
1278-
if (IsDeprecatedRPCEnabled("addmultisigaddress")) {
1279-
return EncodeDestination(innerID);
1280-
}
1281-
12821273
UniValue result(UniValue::VOBJ);
12831274
result.pushKV("address", EncodeDestination(innerID));
12841275
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end()));

test/functional/deprecated_rpc.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test deprecation of RPC calls."""
66
from test_framework.test_framework import BitcoinTestFramework
7-
from test_framework.util import assert_raises_rpc_error
87

98
class DeprecatedRpcTest(BitcoinTestFramework):
109
def set_test_params(self):
1110
self.num_nodes = 2
1211
self.setup_clean_chain = True
13-
self.extra_args = [[], ["-deprecatedrpc=estimatefee", "-deprecatedrpc=createmultisig"]]
12+
self.extra_args = [[], []]
1413

1514
def run_test(self):
16-
self.log.info("estimatefee: Shows deprecated message")
17-
assert_raises_rpc_error(-32, 'estimatefee is deprecated', self.nodes[0].estimatefee, 1)
18-
19-
self.log.info("Using -deprecatedrpc=estimatefee bypasses the error")
20-
self.nodes[1].estimatefee(1)
21-
22-
self.log.info("Make sure that -deprecatedrpc=createmultisig allows it to take addresses")
23-
assert_raises_rpc_error(-5, "Invalid public key", self.nodes[0].createmultisig, 1, [self.nodes[0].getnewaddress()])
24-
self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()])
15+
# This test should be used to verify correct behaviour of deprecated
16+
# RPC methods with and without the -deprecatedrpc flags. For example:
17+
#
18+
# self.log.info("Make sure that -deprecatedrpc=createmultisig allows it to take addresses")
19+
# assert_raises_rpc_error(-5, "Invalid public key", self.nodes[0].createmultisig, 1, [self.nodes[0].getnewaddress()])
20+
# self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()])
21+
#
22+
# There are currently no deprecated RPC methods in master, so this
23+
# test is currently empty.
24+
pass
2525

2626
if __name__ == '__main__':
2727
DeprecatedRpcTest().main()

0 commit comments

Comments
 (0)