Skip to content

Commit fa0815c

Browse files
ch4ot1cMarcoFalke
authored and
MarcoFalke
committed
rpc: Correctly name arguments
1 parent c651265 commit fa0815c

13 files changed

+33
-32
lines changed

src/rpc/blockchain.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
287287
{
288288
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
289289
throw std::runtime_error(
290-
"waitforblockheight <height> (timeout)\n"
290+
"waitforblockheight height ( timeout )\n"
291291
"\nWaits for (at least) block height and returns the height and hash\n"
292292
"of the current tip.\n"
293293
"\nReturns the current block on timeout or exit.\n"
294294
"\nArguments:\n"
295-
"1. height (required, int) Block height to wait for (int)\n"
295+
"1. height (int, required) Block height to wait for.\n"
296296
"2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
297297
"\nResult:\n"
298298
"{ (json object)\n"
@@ -696,11 +696,11 @@ static UniValue getblockheader(const JSONRPCRequest& request)
696696
{
697697
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
698698
throw std::runtime_error(
699-
"getblockheader \"hash\" ( verbose )\n"
699+
"getblockheader \"blockhash\" ( verbose )\n"
700700
"\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n"
701701
"If verbose is true, returns an Object with information about blockheader <hash>.\n"
702702
"\nArguments:\n"
703-
"1. \"hash\" (string, required) The block hash\n"
703+
"1. \"blockhash\" (string, required) The block hash\n"
704704
"2. verbose (boolean, optional, default=true) true for a json object, false for the hex-encoded data\n"
705705
"\nResult (for verbose = true):\n"
706706
"{\n"
@@ -926,7 +926,7 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
926926
{
927927
if (request.fHelp || request.params.size() != 1)
928928
throw std::runtime_error(
929-
"pruneblockchain\n"
929+
"pruneblockchain height\n"
930930
"\nArguments:\n"
931931
"1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
932932
" to prune blocks whose block time is at least 2 hours older than the provided timestamp.\n"
@@ -1563,7 +1563,7 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
15631563
{
15641564
if (request.fHelp || request.params.size() > 2)
15651565
throw std::runtime_error(
1566-
"getchaintxstats ( nblocks blockhash )\n"
1566+
"getchaintxstats ( nblocks \"blockhash\" )\n"
15671567
"\nCompute statistics about the total number and rate of transactions in the chain.\n"
15681568
"\nArguments:\n"
15691569
"1. nblocks (numeric, optional) Size of the window in number of blocks (default: one month).\n"
@@ -2040,7 +2040,7 @@ UniValue scantxoutset(const JSONRPCRequest& request)
20402040
{
20412041
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
20422042
throw std::runtime_error(
2043-
"scantxoutset <action> ( <scanobjects> )\n"
2043+
"scantxoutset \"action\" [scanobjects,...]\n"
20442044
"\nEXPERIMENTAL warning: this call may be removed or changed in future releases.\n"
20452045
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
20462046
"Examples of output descriptors are:\n"

src/rpc/mining.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
232232
{
233233
if (request.fHelp || request.params.size() != 3)
234234
throw std::runtime_error(
235-
"prioritisetransaction <txid> <dummy value> <fee delta>\n"
235+
"prioritisetransaction \"txid\" dummy fee_delta\n"
236236
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
237237
"\nArguments:\n"
238238
"1. \"txid\" (string, required) The transaction id.\n"
@@ -295,7 +295,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
295295
{
296296
if (request.fHelp || request.params.size() > 1)
297297
throw std::runtime_error(
298-
"getblocktemplate ( TemplateRequest )\n"
298+
"getblocktemplate ( \"template_request\" )\n"
299299
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
300300
"It returns data needed to construct a block to work on.\n"
301301
"For full specification, see BIPs 22, 23, 9, and 145:\n"

src/rpc/net.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static UniValue addnode(const JSONRPCRequest& request)
201201
if (request.fHelp || request.params.size() != 2 ||
202202
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
203203
throw std::runtime_error(
204-
"addnode \"node\" \"add|remove|onetry\"\n"
204+
"addnode \"node\" \"command\"\n"
205205
"\nAttempts to add or remove a node from the addnode list.\n"
206206
"Or try a connection to a node once.\n"
207207
"Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n"
@@ -244,13 +244,13 @@ static UniValue disconnectnode(const JSONRPCRequest& request)
244244
{
245245
if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3)
246246
throw std::runtime_error(
247-
"disconnectnode \"[address]\" [nodeid]\n"
247+
"disconnectnode ( \"address\" nodeid )\n"
248248
"\nImmediately disconnects from the specified peer node.\n"
249249
"\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
250250
"\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n"
251251
"\nArguments:\n"
252252
"1. \"address\" (string, optional) The IP address/port of the node\n"
253-
"2. \"nodeid\" (number, optional) The node ID (see getpeerinfo for node IDs)\n"
253+
"2. nodeid (number, optional) The node ID (see getpeerinfo for node IDs)\n"
254254
"\nExamples:\n"
255255
+ HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
256256
+ HelpExampleCli("disconnectnode", "\"\" 1")
@@ -500,7 +500,7 @@ static UniValue setban(const JSONRPCRequest& request)
500500
if (request.fHelp || request.params.size() < 2 ||
501501
(strCommand != "add" && strCommand != "remove"))
502502
throw std::runtime_error(
503-
"setban \"subnet\" \"add|remove\" (bantime) (absolute)\n"
503+
"setban \"subnet\" \"command\" ( bantime absolute )\n"
504504
"\nAttempts to add or remove an IP/Subnet from the banned list.\n"
505505
"\nArguments:\n"
506506
"1. \"subnet\" (string, required) The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)\n"
@@ -611,7 +611,7 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
611611
{
612612
if (request.fHelp || request.params.size() != 1) {
613613
throw std::runtime_error(
614-
"setnetworkactive true|false\n"
614+
"setnetworkactive state\n"
615615
"\nDisable/enable all p2p network activity.\n"
616616
"\nArguments:\n"
617617
"1. \"state\" (boolean, required) true to enable networking, false to disable\n"

src/rpc/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
235235

236236
static UniValue uptime(const JSONRPCRequest& jsonRequest)
237237
{
238-
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
238+
if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
239239
throw std::runtime_error(
240240
"uptime\n"
241241
"\nReturns the total uptime of the server.\n"

src/wallet/rpcdump.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
348348

349349
if (request.fHelp || request.params.size() != 2)
350350
throw std::runtime_error(
351-
"importprunedfunds\n"
351+
"importprunedfunds \"rawtransaction\" \"txoutproof\"\n"
352352
"\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n"
353353
"\nArguments:\n"
354354
"1. \"rawtransaction\" (string, required) A raw transaction in hex funding an already-existing address in wallet\n"
@@ -1085,8 +1085,8 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
10851085
// clang-format off
10861086
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2)
10871087
throw std::runtime_error(
1088-
"importmulti \"requests\" ( \"options\" )\n\n"
1089-
"Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options). Requires a new wallet backup.\n\n"
1088+
"importmulti \"requests\" ( \"options\" )\n"
1089+
"\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options). Requires a new wallet backup.\n\n"
10901090
"Arguments:\n"
10911091
"1. requests (array, required) Data to be imported\n"
10921092
" [ (array of json objects)\n"

src/wallet/rpcwallet.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static UniValue getbalance(const JSONRPCRequest& request)
693693

694694
if (request.fHelp || (request.params.size() > 3 ))
695695
throw std::runtime_error(
696-
"getbalance ( \"(dummy)\" minconf include_watchonly )\n"
696+
"getbalance ( \"dummy\" minconf include_watchonly )\n"
697697
"\nReturns the total available balance.\n"
698698
"The available balance is what the wallet considers currently spendable, and is\n"
699699
"thus affected by options which limit spendability such as -spendzeroconfchange.\n"
@@ -1352,7 +1352,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
13521352

13531353
if (request.fHelp || request.params.size() > 4)
13541354
throw std::runtime_error(
1355-
"listtransactions (dummy count skip include_watchonly)\n"
1355+
"listtransactions ( \"dummy\" count skip include_watchonly)\n"
13561356
"\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n"
13571357
"\nArguments:\n"
13581358
"1. \"dummy\" (string, optional) If set, should be \"*\" for backwards compatibility.\n"

test/functional/feature_pruning.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def height(index):
249249
return index
250250

251251
def prune(index, expected_ret=None):
252-
ret = node.pruneblockchain(height(index))
252+
ret = node.pruneblockchain(height=height(index))
253253
# Check the return value. When use_timestamp is True, just check
254254
# that the return value is less than or equal to the expected
255255
# value, because when more than one block is generated per second,

test/functional/mining_basic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
def assert_template(node, block, expect, rehash=True):
3131
if rehash:
3232
block.hashMerkleRoot = block.calc_merkle_root()
33-
rsp = node.getblocktemplate({'data': b2x(block.serialize()), 'mode': 'proposal'})
33+
rsp = node.getblocktemplate(template_request={'data': b2x(block.serialize()), 'mode': 'proposal'})
3434
assert_equal(rsp, expect)
3535

36+
3637
class MiningTest(BitcoinTestFramework):
3738
def set_test_params(self):
3839
self.num_nodes = 2

test/functional/p2p_disconnect_ban.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def run_test(self):
2222

2323
self.log.info("setban: successfully ban single IP address")
2424
assert_equal(len(self.nodes[1].getpeerinfo()), 2) # node1 should have 2 connections to node0 at this point
25-
self.nodes[1].setban("127.0.0.1", "add")
25+
self.nodes[1].setban(subnet="127.0.0.1", command="add")
2626
wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 0, timeout=10)
2727
assert_equal(len(self.nodes[1].getpeerinfo()), 0) # all nodes must be disconnected at this point
2828
assert_equal(len(self.nodes[1].listbanned()), 1)

test/functional/rpc_blockchain.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _test_getchaintxstats(self):
133133
assert_raises_rpc_error(-8, "Block is not in main chain", self.nodes[0].getchaintxstats, blockhash=blockhash)
134134
self.nodes[0].reconsiderblock(blockhash)
135135

136-
chaintxstats = self.nodes[0].getchaintxstats(1)
136+
chaintxstats = self.nodes[0].getchaintxstats(nblocks=1)
137137
# 200 txs plus genesis tx
138138
assert_equal(chaintxstats['txcount'], 201)
139139
# tx rate should be 1 per 10 minutes, or 1/600
@@ -211,7 +211,7 @@ def _test_getblockheader(self):
211211

212212
besthash = node.getbestblockhash()
213213
secondbesthash = node.getblockhash(199)
214-
header = node.getblockheader(besthash)
214+
header = node.getblockheader(blockhash=besthash)
215215

216216
assert_equal(header['hash'], besthash)
217217
assert_equal(header['height'], 200)
@@ -287,7 +287,7 @@ def solve_and_send_block(prevhash, height, time):
287287

288288
def assert_waitforheight(height, timeout=2):
289289
assert_equal(
290-
node.waitforblockheight(height, timeout)['height'],
290+
node.waitforblockheight(height=height, timeout=timeout)['height'],
291291
current_height)
292292

293293
assert_waitforheight(0)

test/functional/rpc_net.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ def _test_getnetworkinginfo(self):
7474
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
7575
assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2)
7676

77-
self.nodes[0].setnetworkactive(False)
77+
self.nodes[0].setnetworkactive(state=False)
7878
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], False)
7979
# Wait a bit for all sockets to close
8080
wait_until(lambda: self.nodes[0].getnetworkinfo()['connections'] == 0, timeout=3)
8181

82-
self.nodes[0].setnetworkactive(True)
82+
self.nodes[0].setnetworkactive(state=True)
8383
connect_nodes_bi(self.nodes, 0, 1)
8484
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
8585
assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2)
@@ -88,7 +88,7 @@ def _test_getaddednodeinfo(self):
8888
assert_equal(self.nodes[0].getaddednodeinfo(), [])
8989
# add a node (node2) to node0
9090
ip_port = "127.0.0.1:{}".format(p2p_port(2))
91-
self.nodes[0].addnode(ip_port, 'add')
91+
self.nodes[0].addnode(node=ip_port, command='add')
9292
# check that the node has indeed been added
9393
added_nodes = self.nodes[0].getaddednodeinfo(ip_port)
9494
assert_equal(len(added_nodes), 1)

test/functional/wallet_importmulti.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def run_test (self):
152152
"pubkeys": [ address['pubkey'] ],
153153
"internal": True
154154
}]
155-
result = self.nodes[1].importmulti(request)
155+
result = self.nodes[1].importmulti(requests=request)
156156
assert_equal(result[0]['success'], True)
157157
address_assert = self.nodes[1].getaddressinfo(address['address'])
158158
assert_equal(address_assert['iswatchonly'], True)
@@ -167,7 +167,7 @@ def run_test (self):
167167
"timestamp": "now",
168168
"pubkeys": [ address['pubkey'] ]
169169
}]
170-
result = self.nodes[1].importmulti(request)
170+
result = self.nodes[1].importmulti(requests=request)
171171
assert_equal(result[0]['success'], False)
172172
assert_equal(result[0]['error']['code'], -8)
173173
assert_equal(result[0]['error']['message'], 'Internal must be set to true for nonstandard scriptPubKey imports.')

test/functional/wallet_importprunedfunds.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def run_test(self):
8181

8282
# Import with affiliated address with no rescan
8383
self.nodes[1].importaddress(address=address2, rescan=False)
84-
self.nodes[1].importprunedfunds(rawtxn2, proof2)
84+
self.nodes[1].importprunedfunds(rawtransaction=rawtxn2, txoutproof=proof2)
8585
assert [tx for tx in self.nodes[1].listtransactions(include_watchonly=True) if tx['txid'] == txnid2]
8686

8787
# Import with private key with no rescan

0 commit comments

Comments
 (0)