rpc: Correctly name arguments
This commit is contained in:
parent
c651265c93
commit
fa0815c300
13 changed files with 33 additions and 32 deletions
|
@ -287,12 +287,12 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"waitforblockheight <height> (timeout)\n"
|
||||
"waitforblockheight height ( timeout )\n"
|
||||
"\nWaits for (at least) block height and returns the height and hash\n"
|
||||
"of the current tip.\n"
|
||||
"\nReturns the current block on timeout or exit.\n"
|
||||
"\nArguments:\n"
|
||||
"1. height (required, int) Block height to wait for (int)\n"
|
||||
"1. height (int, required) Block height to wait for.\n"
|
||||
"2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
|
||||
"\nResult:\n"
|
||||
"{ (json object)\n"
|
||||
|
@ -696,11 +696,11 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"getblockheader \"hash\" ( verbose )\n"
|
||||
"getblockheader \"blockhash\" ( verbose )\n"
|
||||
"\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n"
|
||||
"If verbose is true, returns an Object with information about blockheader <hash>.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"hash\" (string, required) The block hash\n"
|
||||
"1. \"blockhash\" (string, required) The block hash\n"
|
||||
"2. verbose (boolean, optional, default=true) true for a json object, false for the hex-encoded data\n"
|
||||
"\nResult (for verbose = true):\n"
|
||||
"{\n"
|
||||
|
@ -926,7 +926,7 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
"pruneblockchain\n"
|
||||
"pruneblockchain height\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
|
||||
" 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)
|
|||
{
|
||||
if (request.fHelp || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"getchaintxstats ( nblocks blockhash )\n"
|
||||
"getchaintxstats ( nblocks \"blockhash\" )\n"
|
||||
"\nCompute statistics about the total number and rate of transactions in the chain.\n"
|
||||
"\nArguments:\n"
|
||||
"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)
|
|||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"scantxoutset <action> ( <scanobjects> )\n"
|
||||
"scantxoutset \"action\" [scanobjects,...]\n"
|
||||
"\nEXPERIMENTAL warning: this call may be removed or changed in future releases.\n"
|
||||
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
|
||||
"Examples of output descriptors are:\n"
|
||||
|
|
|
@ -232,7 +232,7 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() != 3)
|
||||
throw std::runtime_error(
|
||||
"prioritisetransaction <txid> <dummy value> <fee delta>\n"
|
||||
"prioritisetransaction \"txid\" dummy fee_delta\n"
|
||||
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"txid\" (string, required) The transaction id.\n"
|
||||
|
@ -295,7 +295,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
"getblocktemplate ( TemplateRequest )\n"
|
||||
"getblocktemplate ( \"template_request\" )\n"
|
||||
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
|
||||
"It returns data needed to construct a block to work on.\n"
|
||||
"For full specification, see BIPs 22, 23, 9, and 145:\n"
|
||||
|
|
|
@ -201,7 +201,7 @@ static UniValue addnode(const JSONRPCRequest& request)
|
|||
if (request.fHelp || request.params.size() != 2 ||
|
||||
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
|
||||
throw std::runtime_error(
|
||||
"addnode \"node\" \"add|remove|onetry\"\n"
|
||||
"addnode \"node\" \"command\"\n"
|
||||
"\nAttempts to add or remove a node from the addnode list.\n"
|
||||
"Or try a connection to a node once.\n"
|
||||
"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)
|
|||
{
|
||||
if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3)
|
||||
throw std::runtime_error(
|
||||
"disconnectnode \"[address]\" [nodeid]\n"
|
||||
"disconnectnode ( \"address\" nodeid )\n"
|
||||
"\nImmediately disconnects from the specified peer node.\n"
|
||||
"\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
|
||||
"\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"address\" (string, optional) The IP address/port of the node\n"
|
||||
"2. \"nodeid\" (number, optional) The node ID (see getpeerinfo for node IDs)\n"
|
||||
"2. nodeid (number, optional) The node ID (see getpeerinfo for node IDs)\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
|
||||
+ HelpExampleCli("disconnectnode", "\"\" 1")
|
||||
|
@ -500,7 +500,7 @@ static UniValue setban(const JSONRPCRequest& request)
|
|||
if (request.fHelp || request.params.size() < 2 ||
|
||||
(strCommand != "add" && strCommand != "remove"))
|
||||
throw std::runtime_error(
|
||||
"setban \"subnet\" \"add|remove\" (bantime) (absolute)\n"
|
||||
"setban \"subnet\" \"command\" ( bantime absolute )\n"
|
||||
"\nAttempts to add or remove an IP/Subnet from the banned list.\n"
|
||||
"\nArguments:\n"
|
||||
"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)
|
|||
{
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw std::runtime_error(
|
||||
"setnetworkactive true|false\n"
|
||||
"setnetworkactive state\n"
|
||||
"\nDisable/enable all p2p network activity.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"state\" (boolean, required) true to enable networking, false to disable\n"
|
||||
|
|
|
@ -235,7 +235,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
|
|||
|
||||
static UniValue uptime(const JSONRPCRequest& jsonRequest)
|
||||
{
|
||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
|
||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
|
||||
throw std::runtime_error(
|
||||
"uptime\n"
|
||||
"\nReturns the total uptime of the server.\n"
|
||||
|
|
|
@ -348,7 +348,7 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
|
|||
|
||||
if (request.fHelp || request.params.size() != 2)
|
||||
throw std::runtime_error(
|
||||
"importprunedfunds\n"
|
||||
"importprunedfunds \"rawtransaction\" \"txoutproof\"\n"
|
||||
"\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"
|
||||
"\nArguments:\n"
|
||||
"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)
|
|||
// clang-format off
|
||||
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"importmulti \"requests\" ( \"options\" )\n\n"
|
||||
"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"
|
||||
"importmulti \"requests\" ( \"options\" )\n"
|
||||
"\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"
|
||||
"Arguments:\n"
|
||||
"1. requests (array, required) Data to be imported\n"
|
||||
" [ (array of json objects)\n"
|
||||
|
|
|
@ -693,7 +693,7 @@ static UniValue getbalance(const JSONRPCRequest& request)
|
|||
|
||||
if (request.fHelp || (request.params.size() > 3 ))
|
||||
throw std::runtime_error(
|
||||
"getbalance ( \"(dummy)\" minconf include_watchonly )\n"
|
||||
"getbalance ( \"dummy\" minconf include_watchonly )\n"
|
||||
"\nReturns the total available balance.\n"
|
||||
"The available balance is what the wallet considers currently spendable, and is\n"
|
||||
"thus affected by options which limit spendability such as -spendzeroconfchange.\n"
|
||||
|
@ -1352,7 +1352,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
|
|||
|
||||
if (request.fHelp || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
"listtransactions (dummy count skip include_watchonly)\n"
|
||||
"listtransactions ( \"dummy\" count skip include_watchonly)\n"
|
||||
"\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"dummy\" (string, optional) If set, should be \"*\" for backwards compatibility.\n"
|
||||
|
|
|
@ -249,7 +249,7 @@ class PruneTest(BitcoinTestFramework):
|
|||
return index
|
||||
|
||||
def prune(index, expected_ret=None):
|
||||
ret = node.pruneblockchain(height(index))
|
||||
ret = node.pruneblockchain(height=height(index))
|
||||
# Check the return value. When use_timestamp is True, just check
|
||||
# that the return value is less than or equal to the expected
|
||||
# value, because when more than one block is generated per second,
|
||||
|
|
|
@ -30,9 +30,10 @@ from test_framework.util import (
|
|||
def assert_template(node, block, expect, rehash=True):
|
||||
if rehash:
|
||||
block.hashMerkleRoot = block.calc_merkle_root()
|
||||
rsp = node.getblocktemplate({'data': b2x(block.serialize()), 'mode': 'proposal'})
|
||||
rsp = node.getblocktemplate(template_request={'data': b2x(block.serialize()), 'mode': 'proposal'})
|
||||
assert_equal(rsp, expect)
|
||||
|
||||
|
||||
class MiningTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
|
|
|
@ -22,7 +22,7 @@ class DisconnectBanTest(BitcoinTestFramework):
|
|||
|
||||
self.log.info("setban: successfully ban single IP address")
|
||||
assert_equal(len(self.nodes[1].getpeerinfo()), 2) # node1 should have 2 connections to node0 at this point
|
||||
self.nodes[1].setban("127.0.0.1", "add")
|
||||
self.nodes[1].setban(subnet="127.0.0.1", command="add")
|
||||
wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 0, timeout=10)
|
||||
assert_equal(len(self.nodes[1].getpeerinfo()), 0) # all nodes must be disconnected at this point
|
||||
assert_equal(len(self.nodes[1].listbanned()), 1)
|
||||
|
|
|
@ -133,7 +133,7 @@ class BlockchainTest(BitcoinTestFramework):
|
|||
assert_raises_rpc_error(-8, "Block is not in main chain", self.nodes[0].getchaintxstats, blockhash=blockhash)
|
||||
self.nodes[0].reconsiderblock(blockhash)
|
||||
|
||||
chaintxstats = self.nodes[0].getchaintxstats(1)
|
||||
chaintxstats = self.nodes[0].getchaintxstats(nblocks=1)
|
||||
# 200 txs plus genesis tx
|
||||
assert_equal(chaintxstats['txcount'], 201)
|
||||
# tx rate should be 1 per 10 minutes, or 1/600
|
||||
|
@ -211,7 +211,7 @@ class BlockchainTest(BitcoinTestFramework):
|
|||
|
||||
besthash = node.getbestblockhash()
|
||||
secondbesthash = node.getblockhash(199)
|
||||
header = node.getblockheader(besthash)
|
||||
header = node.getblockheader(blockhash=besthash)
|
||||
|
||||
assert_equal(header['hash'], besthash)
|
||||
assert_equal(header['height'], 200)
|
||||
|
@ -287,7 +287,7 @@ class BlockchainTest(BitcoinTestFramework):
|
|||
|
||||
def assert_waitforheight(height, timeout=2):
|
||||
assert_equal(
|
||||
node.waitforblockheight(height, timeout)['height'],
|
||||
node.waitforblockheight(height=height, timeout=timeout)['height'],
|
||||
current_height)
|
||||
|
||||
assert_waitforheight(0)
|
||||
|
|
|
@ -74,12 +74,12 @@ class NetTest(BitcoinTestFramework):
|
|||
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
|
||||
assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2)
|
||||
|
||||
self.nodes[0].setnetworkactive(False)
|
||||
self.nodes[0].setnetworkactive(state=False)
|
||||
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], False)
|
||||
# Wait a bit for all sockets to close
|
||||
wait_until(lambda: self.nodes[0].getnetworkinfo()['connections'] == 0, timeout=3)
|
||||
|
||||
self.nodes[0].setnetworkactive(True)
|
||||
self.nodes[0].setnetworkactive(state=True)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
|
||||
assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2)
|
||||
|
@ -88,7 +88,7 @@ class NetTest(BitcoinTestFramework):
|
|||
assert_equal(self.nodes[0].getaddednodeinfo(), [])
|
||||
# add a node (node2) to node0
|
||||
ip_port = "127.0.0.1:{}".format(p2p_port(2))
|
||||
self.nodes[0].addnode(ip_port, 'add')
|
||||
self.nodes[0].addnode(node=ip_port, command='add')
|
||||
# check that the node has indeed been added
|
||||
added_nodes = self.nodes[0].getaddednodeinfo(ip_port)
|
||||
assert_equal(len(added_nodes), 1)
|
||||
|
|
|
@ -152,7 +152,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
"pubkeys": [ address['pubkey'] ],
|
||||
"internal": True
|
||||
}]
|
||||
result = self.nodes[1].importmulti(request)
|
||||
result = self.nodes[1].importmulti(requests=request)
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
|
@ -167,7 +167,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
"timestamp": "now",
|
||||
"pubkeys": [ address['pubkey'] ]
|
||||
}]
|
||||
result = self.nodes[1].importmulti(request)
|
||||
result = self.nodes[1].importmulti(requests=request)
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -8)
|
||||
assert_equal(result[0]['error']['message'], 'Internal must be set to true for nonstandard scriptPubKey imports.')
|
||||
|
|
|
@ -81,7 +81,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
|||
|
||||
# Import with affiliated address with no rescan
|
||||
self.nodes[1].importaddress(address=address2, rescan=False)
|
||||
self.nodes[1].importprunedfunds(rawtxn2, proof2)
|
||||
self.nodes[1].importprunedfunds(rawtransaction=rawtxn2, txoutproof=proof2)
|
||||
assert [tx for tx in self.nodes[1].listtransactions(include_watchonly=True) if tx['txid'] == txnid2]
|
||||
|
||||
# Import with private key with no rescan
|
||||
|
|
Loading…
Reference in a new issue