diff options
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/blockchain.cpp | 222 | ||||
-rw-r--r-- | src/rpc/mining.cpp | 50 | ||||
-rw-r--r-- | src/rpc/misc.cpp | 27 | ||||
-rw-r--r-- | src/rpc/net.cpp | 158 | ||||
-rw-r--r-- | src/rpc/rawtransaction.cpp | 85 | ||||
-rw-r--r-- | src/rpc/rawtransaction_util.h | 2 | ||||
-rw-r--r-- | src/rpc/server.cpp | 10 |
7 files changed, 293 insertions, 261 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index eb5148eebd..9b06aba22b 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -229,7 +229,7 @@ static UniValue waitfornewblock(const JSONRPCRequest& request) RPCResult{ "{ (json object)\n" " \"hash\" : { (string) The blockhash\n" - " \"height\" : { (int) Block height\n" + " \"height\" : { (numeric) Block height\n" "}\n" }, RPCExamples{ @@ -269,7 +269,7 @@ static UniValue waitforblock(const JSONRPCRequest& request) RPCResult{ "{ (json object)\n" " \"hash\" : { (string) The blockhash\n" - " \"height\" : { (int) Block height\n" + " \"height\" : { (numeric) Block height\n" "}\n" }, RPCExamples{ @@ -313,7 +313,7 @@ static UniValue waitforblockheight(const JSONRPCRequest& request) RPCResult{ "{ (json object)\n" " \"hash\" : { (string) The blockhash\n" - " \"height\" : { (int) Block height\n" + " \"height\" : { (numeric) Block height\n" "}\n" }, RPCExamples{ @@ -400,10 +400,10 @@ static std::string EntryDescriptionString() " \"ancestor\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in " + CURRENCY_UNIT + "\n" " \"descendant\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) in " + CURRENCY_UNIT + "\n" " }\n" - " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n" + " \"depends\" : [ (json array) unconfirmed transactions used as inputs for this transaction\n" " \"transactionid\", (string) parent transaction id\n" " ... ]\n" - " \"spentby\" : [ (array) unconfirmed transactions spending outputs from this transaction\n" + " \"spentby\" : [ (json array) unconfirmed transactions spending outputs from this transaction\n" " \"transactionid\", (string) child transaction id\n" " ... ]\n" " \"bip125-replaceable\" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee)\n"; @@ -984,14 +984,14 @@ static UniValue gettxoutsetinfo(const JSONRPCRequest& request) {}, RPCResult{ "{\n" - " \"height\":n, (numeric) The current block height (index)\n" - " \"bestblock\": \"hex\", (string) The hash of the block at the tip of the chain\n" - " \"transactions\": n, (numeric) The number of transactions with unspent outputs\n" - " \"txouts\": n, (numeric) The number of unspent transaction outputs\n" - " \"bogosize\": n, (numeric) A meaningless metric for UTXO set size\n" + " \"height\" : n, (numeric) The current block height (index)\n" + " \"bestblock\" : \"hex\", (string) The hash of the block at the tip of the chain\n" + " \"transactions\" : n, (numeric) The number of transactions with unspent outputs\n" + " \"txouts\" : n, (numeric) The number of unspent transaction outputs\n" + " \"bogosize\" : n, (numeric) A meaningless metric for UTXO set size\n" " \"hash_serialized_2\": \"hash\", (string) The serialized hash\n" - " \"disk_size\": n, (numeric) The estimated size of the chainstate on disk\n" - " \"total_amount\": x.xxx (numeric) The total amount\n" + " \"disk_size\" : n, (numeric) The estimated size of the chainstate on disk\n" + " \"total_amount\" : x.xxx (numeric) The total amount\n" "}\n" }, RPCExamples{ @@ -1032,7 +1032,7 @@ UniValue gettxout(const JSONRPCRequest& request) }, RPCResult{ "{\n" - " \"bestblock\": \"hash\", (string) The hash of the block at the tip of the chain\n" + " \"bestblock\" : \"hash\", (string) The hash of the block at the tip of the chain\n" " \"confirmations\" : n, (numeric) The number of confirmations\n" " \"value\" : x.xxx, (numeric) The transaction value in " + CURRENCY_UNIT + "\n" " \"scriptPubKey\" : { (json object)\n" @@ -1204,39 +1204,39 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) {}, RPCResult{ "{\n" - " \"chain\": \"xxxx\", (string) current network name (main, test, regtest)\n" - " \"blocks\": xxxxxx, (numeric) the height of the most-work fully-validated chain. The genesis block has height 0\n" - " \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n" - " \"bestblockhash\": \"...\", (string) the hash of the currently best block\n" - " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" - " \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" - " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" - " \"initialblockdownload\": xxxx, (bool) (debug information) estimate of whether this node is in Initial Block Download mode.\n" - " \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n" - " \"size_on_disk\": xxxxxx, (numeric) the estimated size of the block and undo files on disk\n" - " \"pruned\": xx, (boolean) if the blocks are subject to pruning\n" - " \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored (only present if pruning is enabled)\n" - " \"automatic_pruning\": xx, (boolean) whether automatic pruning is enabled (only present if pruning is enabled)\n" - " \"prune_target_size\": xxxxxx, (numeric) the target size used by pruning (only present if automatic pruning is enabled)\n" - " \"softforks\": { (object) status of softforks\n" + " \"chain\" : \"xxxx\", (string) current network name (main, test, regtest)\n" + " \"blocks\" : xxxxxx, (numeric) the height of the most-work fully-validated chain. The genesis block has height 0\n" + " \"headers\" : xxxxxx, (numeric) the current number of headers we have validated\n" + " \"bestblockhash\" : \"...\", (string) the hash of the currently best block\n" + " \"difficulty\" : xxxxxx, (numeric) the current difficulty\n" + " \"mediantime\" : xxxxxx, (numeric) median time for the current best block\n" + " \"verificationprogress\" : xxxx, (numeric) estimate of verification progress [0..1]\n" + " \"initialblockdownload\" : xxxx, (boolean) (debug information) estimate of whether this node is in Initial Block Download mode.\n" + " \"chainwork\" : \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n" + " \"size_on_disk\" : xxxxxx, (numeric) the estimated size of the block and undo files on disk\n" + " \"pruned\" : xx, (boolean) if the blocks are subject to pruning\n" + " \"pruneheight\" : xxxxxx, (numeric) lowest-height complete block stored (only present if pruning is enabled)\n" + " \"automatic_pruning\" : xx, (boolean) whether automatic pruning is enabled (only present if pruning is enabled)\n" + " \"prune_target_size\" : xxxxxx, (numeric) the target size used by pruning (only present if automatic pruning is enabled)\n" + " \"softforks\" : { (json object) status of softforks\n" " \"xxxx\" : { (string) name of the softfork\n" - " \"type\": \"xxxx\", (string) one of \"buried\", \"bip9\"\n" - " \"bip9\": { (object) status of bip9 softforks (only for \"bip9\" type)\n" - " \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"\n" - " \"bit\": xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for \"started\" status)\n" - " \"start_time\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n" - " \"timeout\": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n" - " \"since\": xx, (numeric) height of the first block to which the status applies\n" - " \"statistics\": { (object) numeric statistics about BIP9 signalling for a softfork\n" - " \"period\": xx, (numeric) the length in blocks of the BIP9 signalling period \n" - " \"threshold\": xx, (numeric) the number of blocks with the version bit set required to activate the feature \n" - " \"elapsed\": xx, (numeric) the number of blocks elapsed since the beginning of the current period \n" - " \"count\": xx, (numeric) the number of blocks with the version bit set in the current period \n" - " \"possible\": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold \n" + " \"type\" : \"xxxx\", (string) one of \"buried\", \"bip9\"\n" + " \"bip9\": { (json object) status of bip9 softforks (only for \"bip9\" type)\n" + " \"status\" : \"xxxx\", (string) one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"\n" + " \"bit\" : xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for \"started\" status)\n" + " \"start_time\" : xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n" + " \"timeout\" : xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n" + " \"since\" : xx, (numeric) height of the first block to which the status applies\n" + " \"statistics\" : { (json object) numeric statistics about BIP9 signalling for a softfork\n" + " \"period\" : xx, (numeric) the length in blocks of the BIP9 signalling period \n" + " \"threshold\" : xx, (numeric) the number of blocks with the version bit set required to activate the feature \n" + " \"elapsed\" : xx, (numeric) the number of blocks elapsed since the beginning of the current period \n" + " \"count\" : xx, (numeric) the number of blocks with the version bit set in the current period \n" + " \"possible\" : xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold \n" " }\n" " },\n" - " \"height\": \"xxxxxx\", (numeric) height of the first block which the rules are or will be enforced (only for \"buried\" type, or \"bip9\" type with \"active\" status)\n" - " \"active\": xx, (boolean) true if the rules are enforced for the mempool and the next block\n" + " \"height\" : \"xxxxxx\", (numeric) height of the first block which the rules are or will be enforced (only for \"buried\" type, or \"bip9\" type with \"active\" status)\n" + " \"active\" : xx, (boolean) true if the rules are enforced for the mempool and the next block\n" " }\n" " }\n" " \"warnings\" : \"...\", (string) any network and blockchain warnings.\n" @@ -1318,16 +1318,16 @@ static UniValue getchaintips(const JSONRPCRequest& request) RPCResult{ "[\n" " {\n" - " \"height\": xxxx, (numeric) height of the chain tip\n" - " \"hash\": \"xxxx\", (string) block hash of the tip\n" - " \"branchlen\": 0 (numeric) zero for main chain\n" - " \"status\": \"active\" (string) \"active\" for the main chain\n" + " \"height\" : xxxx, (numeric) height of the chain tip\n" + " \"hash\" : \"xxxx\", (string) block hash of the tip\n" + " \"branchlen\" : 0 (numeric) zero for main chain\n" + " \"status\" : \"active\" (string) \"active\" for the main chain\n" " },\n" " {\n" - " \"height\": xxxx,\n" - " \"hash\": \"xxxx\",\n" - " \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n" - " \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n" + " \"height\" : xxxx,\n" + " \"hash\" : \"xxxx\",\n" + " \"branchlen\" : 1 (numeric) length of branch connecting the tip to the main chain\n" + " \"status\" : \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n" " }\n" "]\n" "Possible values for status:\n" @@ -1437,13 +1437,13 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request) {}, RPCResult{ "{\n" - " \"loaded\": true|false (boolean) True if the mempool is fully loaded\n" - " \"size\": xxxxx, (numeric) Current tx count\n" - " \"bytes\": xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted\n" - " \"usage\": xxxxx, (numeric) Total memory usage for the mempool\n" - " \"maxmempool\": xxxxx, (numeric) Maximum memory usage for the mempool\n" - " \"mempoolminfee\": xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n" - " \"minrelaytxfee\": xxxxx (numeric) Current minimum relay fee for transactions\n" + " \"loaded\" : true|false (boolean) True if the mempool is fully loaded\n" + " \"size\" : xxxxx, (numeric) Current tx count\n" + " \"bytes\" : xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted\n" + " \"usage\" : xxxxx, (numeric) Total memory usage for the mempool\n" + " \"maxmempool\" : xxxxx, (numeric) Maximum memory usage for the mempool\n" + " \"mempoolminfee\" : xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n" + " \"minrelaytxfee\" : xxxxx (numeric) Current minimum relay fee for transactions\n" "}\n" }, RPCExamples{ @@ -1577,14 +1577,14 @@ static UniValue getchaintxstats(const JSONRPCRequest& request) }, RPCResult{ "{\n" - " \"time\": xxxxx, (numeric) The timestamp for the final block in the window, expressed in " + UNIX_EPOCH_TIME + ".\n" - " \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n" - " \"window_final_block_hash\": \"...\", (string) The hash of the final block in the window.\n" - " \"window_final_block_height\": xxxxx, (numeric) The height of the final block in the window.\n" - " \"window_block_count\": xxxxx, (numeric) Size of the window in number of blocks.\n" - " \"window_tx_count\": xxxxx, (numeric) The number of transactions in the window. Only returned if \"window_block_count\" is > 0.\n" - " \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n" - " \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n" + " \"time\" : xxxxx, (numeric) The timestamp for the final block in the window, expressed in " + UNIX_EPOCH_TIME + ".\n" + " \"txcount\" : xxxxx, (numeric) The total number of transactions in the chain up to that point.\n" + " \"window_final_block_hash\" : \"...\", (string) The hash of the final block in the window.\n" + " \"window_final_block_height\" : xxxxx, (numeric) The height of the final block in the window.\n" + " \"window_block_count\" : xxxxx, (numeric) Size of the window in number of blocks.\n" + " \"window_tx_count\" : xxxxx, (numeric) The number of transactions in the window. Only returned if \"window_block_count\" is > 0.\n" + " \"window_interval\" : xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n" + " \"txrate\" : x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n" "}\n" }, RPCExamples{ @@ -1716,41 +1716,41 @@ static UniValue getblockstats(const JSONRPCRequest& request) }, RPCResult{ "{ (json object)\n" - " \"avgfee\": xxxxx, (numeric) Average fee in the block\n" - " \"avgfeerate\": xxxxx, (numeric) Average feerate (in satoshis per virtual byte)\n" - " \"avgtxsize\": xxxxx, (numeric) Average transaction size\n" - " \"blockhash\": xxxxx, (string) The block hash (to check for potential reorgs)\n" - " \"feerate_percentiles\": [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)\n" + " \"avgfee\" : xxxxx, (numeric) Average fee in the block\n" + " \"avgfeerate\" : xxxxx, (numeric) Average feerate (in satoshis per virtual byte)\n" + " \"avgtxsize\" : xxxxx, (numeric) Average transaction size\n" + " \"blockhash\" : xxxxx, (string) The block hash (to check for potential reorgs)\n" + " \"feerate_percentiles\" : [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)\n" " \"10th_percentile_feerate\", (numeric) The 10th percentile feerate\n" " \"25th_percentile_feerate\", (numeric) The 25th percentile feerate\n" " \"50th_percentile_feerate\", (numeric) The 50th percentile feerate\n" " \"75th_percentile_feerate\", (numeric) The 75th percentile feerate\n" " \"90th_percentile_feerate\", (numeric) The 90th percentile feerate\n" " ],\n" - " \"height\": xxxxx, (numeric) The height of the block\n" - " \"ins\": xxxxx, (numeric) The number of inputs (excluding coinbase)\n" - " \"maxfee\": xxxxx, (numeric) Maximum fee in the block\n" - " \"maxfeerate\": xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte)\n" - " \"maxtxsize\": xxxxx, (numeric) Maximum transaction size\n" - " \"medianfee\": xxxxx, (numeric) Truncated median fee in the block\n" - " \"mediantime\": xxxxx, (numeric) The block median time past\n" - " \"mediantxsize\": xxxxx, (numeric) Truncated median transaction size\n" - " \"minfee\": xxxxx, (numeric) Minimum fee in the block\n" - " \"minfeerate\": xxxxx, (numeric) Minimum feerate (in satoshis per virtual byte)\n" - " \"mintxsize\": xxxxx, (numeric) Minimum transaction size\n" - " \"outs\": xxxxx, (numeric) The number of outputs\n" - " \"subsidy\": xxxxx, (numeric) The block subsidy\n" - " \"swtotal_size\": xxxxx, (numeric) Total size of all segwit transactions\n" - " \"swtotal_weight\": xxxxx, (numeric) Total weight of all segwit transactions divided by segwit scale factor (4)\n" - " \"swtxs\": xxxxx, (numeric) The number of segwit transactions\n" - " \"time\": xxxxx, (numeric) The block time\n" - " \"total_out\": xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee])\n" - " \"total_size\": xxxxx, (numeric) Total size of all non-coinbase transactions\n" - " \"total_weight\": xxxxx, (numeric) Total weight of all non-coinbase transactions divided by segwit scale factor (4)\n" - " \"totalfee\": xxxxx, (numeric) The fee total\n" - " \"txs\": xxxxx, (numeric) The number of transactions (excluding coinbase)\n" - " \"utxo_increase\": xxxxx, (numeric) The increase/decrease in the number of unspent outputs\n" - " \"utxo_size_inc\": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar)\n" + " \"height\" : xxxxx, (numeric) The height of the block\n" + " \"ins\" : xxxxx, (numeric) The number of inputs (excluding coinbase)\n" + " \"maxfee\" : xxxxx, (numeric) Maximum fee in the block\n" + " \"maxfeerate\" : xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte)\n" + " \"maxtxsize\" : xxxxx, (numeric) Maximum transaction size\n" + " \"medianfee\" : xxxxx, (numeric) Truncated median fee in the block\n" + " \"mediantime\" : xxxxx, (numeric) The block median time past\n" + " \"mediantxsize\" : xxxxx, (numeric) Truncated median transaction size\n" + " \"minfee\" : xxxxx, (numeric) Minimum fee in the block\n" + " \"minfeerate\" : xxxxx, (numeric) Minimum feerate (in satoshis per virtual byte)\n" + " \"mintxsize\" : xxxxx, (numeric) Minimum transaction size\n" + " \"outs\" : xxxxx, (numeric) The number of outputs\n" + " \"subsidy\" : xxxxx, (numeric) The block subsidy\n" + " \"swtotal_size\" : xxxxx, (numeric) Total size of all segwit transactions\n" + " \"swtotal_weight\" : xxxxx, (numeric) Total weight of all segwit transactions divided by segwit scale factor (4)\n" + " \"swtxs\" : xxxxx, (numeric) The number of segwit transactions\n" + " \"time\" : xxxxx, (numeric) The block time\n" + " \"total_out\" : xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee])\n" + " \"total_size\" : xxxxx, (numeric) Total size of all non-coinbase transactions\n" + " \"total_weight\" : xxxxx, (numeric) Total weight of all non-coinbase transactions divided by segwit scale factor (4)\n" + " \"totalfee\" : xxxxx, (numeric) The fee total\n" + " \"txs\" : xxxxx, (numeric) The number of transactions (excluding coinbase)\n" + " \"utxo_increase\" : xxxxx, (numeric) The increase/decrease in the number of unspent outputs\n" + " \"utxo_size_inc\" : xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar)\n" "}\n" }, RPCExamples{ @@ -2076,21 +2076,21 @@ UniValue scantxoutset(const JSONRPCRequest& request) }, RPCResult{ "{\n" - " \"success\": true|false, (boolean) Whether the scan was completed\n" - " \"txouts\": n, (numeric) The number of unspent transaction outputs scanned\n" - " \"height\": n, (numeric) The current block height (index)\n" - " \"bestblock\": \"hex\", (string) The hash of the block at the tip of the chain\n" - " \"unspents\": [\n" + " \"success\" : true|false, (boolean) Whether the scan was completed\n" + " \"txouts\" : n, (numeric) The number of unspent transaction outputs scanned\n" + " \"height\" : n, (numeric) The current block height (index)\n" + " \"bestblock\" : \"hex\", (string) The hash of the block at the tip of the chain\n" + " \"unspents\" : [\n" " {\n" - " \"txid\": \"hash\", (string) The transaction id\n" - " \"vout\": n, (numeric) The vout value\n" - " \"scriptPubKey\": \"script\", (string) The script key\n" - " \"desc\": \"descriptor\", (string) A specialized descriptor for the matched scriptPubKey\n" - " \"amount\": x.xxx, (numeric) The total amount in " + CURRENCY_UNIT + " of the unspent output\n" - " \"height\": n, (numeric) Height of the unspent transaction output\n" + " \"txid\" : \"hash\", (string) The transaction id\n" + " \"vout\" : n, (numeric) The vout value\n" + " \"scriptPubKey\" : \"script\", (string) The script key\n" + " \"desc\" : \"descriptor\", (string) A specialized descriptor for the matched scriptPubKey\n" + " \"amount\" : x.xxx, (numeric) The total amount in " + CURRENCY_UNIT + " of the unspent output\n" + " \"height\" : n, (numeric) Height of the unspent transaction output\n" " }\n" " ,...],\n" - " \"total_amount\": x.xxx, (numeric) The total amount of all found unspent outputs in " + CURRENCY_UNIT + "\n" + " \"total_amount\" : x.xxx, (numeric) The total amount of all found unspent outputs in " + CURRENCY_UNIT + "\n" "]\n" }, RPCExamples{""}, @@ -2284,10 +2284,10 @@ UniValue dumptxoutset(const JSONRPCRequest& request) }, RPCResult{ "{\n" - " \"coins_written\": n, (numeric) the number of coins written in the snapshot\n" - " \"base_hash\": \"...\", (string) the hash of the base of the snapshot\n" - " \"base_height\": n, (string) the height of the base of the snapshot\n" - " \"path\": \"...\" (string) the absolute path that the snapshot was written to\n" + " \"coins_written\" : n, (numeric) the number of coins written in the snapshot\n" + " \"base_hash\" : \"...\", (string) the hash of the base of the snapshot\n" + " \"base_height\" : n, (string) the height of the base of the snapshot\n" + " \"path\" : \"...\" (string) the absolute path that the snapshot was written to\n" "]\n" }, RPCExamples{ diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 81da053b4e..ab5d830b2a 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2019 The Bitcoin Core developers +// Copyright (c) 2009-2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -154,7 +154,7 @@ static UniValue generatetodescriptor(const JSONRPCRequest& request) {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."}, }, RPCResult{ - "[ blockhashes ] (array) hashes of blocks generated\n"}, + "[ blockhashes ] (json array) hashes of blocks generated\n"}, RPCExamples{ "\nGenerate 11 blocks to mydesc\n" + HelpExampleCli("generatetodescriptor", "11 \"mydesc\"")}, } @@ -196,7 +196,7 @@ static UniValue generatetoaddress(const JSONRPCRequest& request) {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."}, }, RPCResult{ - "[ blockhashes ] (array) hashes of blocks generated\n" + "[ blockhashes ] (json array) hashes of blocks generated\n" }, RPCExamples{ "\nGenerate 11 blocks to myaddress\n" @@ -231,14 +231,14 @@ static UniValue getmininginfo(const JSONRPCRequest& request) {}, RPCResult{ "{\n" - " \"blocks\": nnn, (numeric) The current block\n" - " \"currentblockweight\": nnn, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled)\n" - " \"currentblocktx\": nnn, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled)\n" - " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" - " \"networkhashps\": nnn, (numeric) The network hashes per second\n" - " \"pooledtx\": n (numeric) The size of the mempool\n" - " \"chain\": \"xxxx\", (string) current network name (main, test, regtest)\n" - " \"warnings\": \"...\" (string) any network and blockchain warnings\n" + " \"blocks\" : nnn, (numeric) The current block\n" + " \"currentblockweight\" : nnn, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled)\n" + " \"currentblocktx\" : nnn, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled)\n" + " \"difficulty\" : xxx.xxxxx (numeric) The current difficulty\n" + " \"networkhashps\" : nnn, (numeric) The network hashes per second\n" + " \"pooledtx\" : n (numeric) The size of the mempool\n" + " \"chain\" : \"xxxx\", (string) current network name (main, test, regtest)\n" + " \"warnings\" : \"...\" (string) any network and blockchain warnings\n" "}\n" }, RPCExamples{ @@ -365,16 +365,16 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) " },\n" " \"vbrequired\" : n, (numeric) bit mask of versionbits the server requires set in submissions\n" " \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n" - " \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n" + " \"transactions\" : [ (json array) contents of non-coinbase transactions that should be included in the next block\n" " {\n" " \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n" " \"txid\" : \"xxxx\", (string) transaction id encoded in little-endian hexadecimal\n" " \"hash\" : \"xxxx\", (string) hash encoded in little-endian hexadecimal (including witness data)\n" - " \"depends\" : [ (array) array of numbers \n" + " \"depends\" : [ (json array) array of numbers \n" " n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is\n" " ,...\n" " ],\n" - " \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n" + " \"fee\" : n, (numeric) difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n" " \"sigops\" : n, (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero\n" " \"weight\" : n, (numeric) total transaction weight, as counted for purposes of block limits\n" " }\n" @@ -850,7 +850,7 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request) RPCResult{ "{\n" " \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n" - " \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n" + " \"errors\" : [ str... ] (json array of strings, optional) Errors encountered during processing\n" " \"blocks\" : n (numeric) block number where estimate was found\n" "}\n" "\n" @@ -908,7 +908,7 @@ static UniValue estimaterawfee(const JSONRPCRequest& request) " lower buckets."}, }, RPCResult{ - "{\n" + "{ (json object) Results are returned for any horizon which tracks blocks up to the confirmation target\n" " \"short\" : { (json object, optional) estimate for short time horizon\n" " \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n" " \"decay\" : x.x, (numeric) exponential decay (per block) for historical moving average of confirmation data\n" @@ -921,14 +921,22 @@ static UniValue estimaterawfee(const JSONRPCRequest& request) " \"inmempool\" : x.x, (numeric) current number of txs in mempool in the feerate range unconfirmed for at least target blocks\n" " \"leftmempool\" : x.x, (numeric) number of txs over history horizon in the feerate range that left mempool unconfirmed after target\n" " },\n" - " \"fail\" : { ... }, (json object, optional) information about the highest range of feerates to fail to meet the threshold\n" - " \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n" + " \"fail\" : { (json object, optional) information about the highest range of feerates to fail to meet the threshold\n" + " ...\n" + " },\n" + " \"errors\" : [ (json array, optional) Errors encountered during processing\n" + " \"str\", (string)\n" + " ...\n" + " ],\n" + " },\n" + " \"medium\" : { (json object, optional) estimate for medium time horizon\n" + " ...\n" + " },\n" + " \"long\" : { (json object, optional) estimate for long time horizon\n" + " ...\n" " },\n" - " \"medium\" : { ... }, (json object, optional) estimate for medium time horizon\n" - " \"long\" : { ... } (json object) estimate for long time horizon\n" "}\n" "\n" - "Results are returned for any horizon which tracks blocks up to the confirmation target.\n" }, RPCExamples{ HelpExampleCli("estimaterawfee", "6 0.9") diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 56bd33b0ec..74faf57011 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -81,8 +81,9 @@ static UniValue createmultisig(const JSONRPCRequest& request) }, RPCResult{ "{\n" - " \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n" - " \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n" + " \"address\" : \"multisigaddress\", (string) The value of the new multisig address.\n" + " \"redeemScript\" : \"script\" (string) The string value of the hex-encoded redemption script.\n" + " \"descriptor\" : \"descriptor\" (string) The descriptor for this multisig\n" "}\n" }, RPCExamples{ @@ -119,9 +120,13 @@ static UniValue createmultisig(const JSONRPCRequest& request) CScript inner; const CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, keystore, inner); + // Make the descriptor + std::unique_ptr<Descriptor> descriptor = InferDescriptor(GetScriptForDestination(dest), keystore); + UniValue result(UniValue::VOBJ); result.pushKV("address", EncodeDestination(dest)); result.pushKV("redeemScript", HexStr(inner.begin(), inner.end())); + result.pushKV("descriptor", descriptor->ToString()); return result; } @@ -182,7 +187,7 @@ UniValue deriveaddresses(const JSONRPCRequest& request) {"range", RPCArg::Type::RANGE, RPCArg::Optional::OMITTED_NAMED_ARG, "If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive."}, }, RPCResult{ - "[ address ] (array) the derived addresses\n" + "[ address ] (json array) the derived addresses\n" }, RPCExamples{ "First three native segwit receive addresses\n" + @@ -413,13 +418,13 @@ static UniValue getmemoryinfo(const JSONRPCRequest& request) { RPCResult{"mode \"stats\"", "{\n" - " \"locked\": { (json object) Information about locked memory manager\n" - " \"used\": xxxxx, (numeric) Number of bytes used\n" - " \"free\": xxxxx, (numeric) Number of bytes available in current arenas\n" - " \"total\": xxxxxxx, (numeric) Total number of bytes managed\n" - " \"locked\": xxxxxx, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk.\n" - " \"chunks_used\": xxxxx, (numeric) Number allocated chunks\n" - " \"chunks_free\": xxxxx, (numeric) Number unused chunks\n" + " \"locked\" : { (json object) Information about locked memory manager\n" + " \"used\" : xxxxx, (numeric) Number of bytes used\n" + " \"free\" : xxxxx, (numeric) Number of bytes available in current arenas\n" + " \"total\" : xxxxxxx, (numeric) Total number of bytes managed\n" + " \"locked\" : xxxxxx, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk.\n" + " \"chunks_used\" : xxxxx, (numeric) Number allocated chunks\n" + " \"chunks_free\" : xxxxx, (numeric) Number unused chunks\n" " }\n" "}\n" }, @@ -492,7 +497,7 @@ UniValue logging(const JSONRPCRequest& request) }, RPCResult{ "{ (json object where keys are the logging categories, and values indicates its status\n" - " \"category\": true|false, (bool) if being debug logged or not. false:inactive, true:active\n" + " \"category\" : true|false, (boolean) if being debug logged or not. false:inactive, true:active\n" " ...\n" "}\n" }, diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 5e53fa5f5d..92542539df 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -79,47 +79,48 @@ static UniValue getpeerinfo(const JSONRPCRequest& request) RPCResult{ "[\n" " {\n" - " \"id\": n, (numeric) Peer index\n" - " \"addr\":\"host:port\", (string) The IP address and port of the peer\n" - " \"addrbind\":\"ip:port\", (string) Bind address of the connection to the peer\n" - " \"addrlocal\":\"ip:port\", (string) Local address as reported by the peer\n" - " \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n" - " \"servicesnames\":[ (array) the services offered, in human-readable form\n" + " \"id\" : n, (numeric) Peer index\n" + " \"addr\" : \"host:port\", (string) The IP address and port of the peer\n" + " \"addrbind\" : \"ip:port\", (string) Bind address of the connection to the peer\n" + " \"addrlocal\" : \"ip:port\", (string) Local address as reported by the peer\n" + " \"mapped_as\" : \"mapped_as\", (string) The AS in the BGP route to the peer used for diversifying peer selection\n" + " \"services\" : \"xxxxxxxxxxxxxxxx\", (string) The services offered\n" + " \"servicesnames\" : [ (json array) the services offered, in human-readable form\n" " \"SERVICE_NAME\", (string) the service name if it is recognised\n" " ...\n" " ],\n" - " \"relaytxes\":true|false, (boolean) Whether peer has asked us to relay transactions to it\n" - " \"lastsend\": ttt, (numeric) The " + UNIX_EPOCH_TIME + " of the last send\n" - " \"lastrecv\": ttt, (numeric) The " + UNIX_EPOCH_TIME + " of the last receive\n" - " \"bytessent\": n, (numeric) The total bytes sent\n" - " \"bytesrecv\": n, (numeric) The total bytes received\n" - " \"conntime\": ttt, (numeric) The " + UNIX_EPOCH_TIME + " of the connection\n" - " \"timeoffset\": ttt, (numeric) The time offset in seconds\n" - " \"pingtime\": n, (numeric) ping time (if available)\n" - " \"minping\": n, (numeric) minimum observed ping time (if any at all)\n" - " \"pingwait\": n, (numeric) ping wait (if non-zero)\n" - " \"version\": v, (numeric) The peer version, such as 70001\n" - " \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n" - " \"inbound\": true|false, (boolean) Inbound (true) or Outbound (false)\n" - " \"addnode\": true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection\n" - " \"startingheight\": n, (numeric) The starting height (block) of the peer\n" - " \"banscore\": n, (numeric) The ban score\n" - " \"synced_headers\": n, (numeric) The last header we have in common with this peer\n" - " \"synced_blocks\": n, (numeric) The last block we have in common with this peer\n" - " \"inflight\": [\n" + " \"relaytxes\" : true|false, (boolean) Whether peer has asked us to relay transactions to it\n" + " \"lastsend\" : ttt, (numeric) The " + UNIX_EPOCH_TIME + " of the last send\n" + " \"lastrecv\" : ttt, (numeric) The " + UNIX_EPOCH_TIME + " of the last receive\n" + " \"bytessent\" : n, (numeric) The total bytes sent\n" + " \"bytesrecv\" : n, (numeric) The total bytes received\n" + " \"conntime\" : ttt, (numeric) The " + UNIX_EPOCH_TIME + " of the connection\n" + " \"timeoffset\" : ttt, (numeric) The time offset in seconds\n" + " \"pingtime\" : n, (numeric) ping time (if available)\n" + " \"minping\" : n, (numeric) minimum observed ping time (if any at all)\n" + " \"pingwait\" : n, (numeric) ping wait (if non-zero)\n" + " \"version\" : v, (numeric) The peer version, such as 70001\n" + " \"subver\" : \"/Satoshi:0.8.5/\", (string) The string version\n" + " \"inbound\" : true|false, (boolean) Inbound (true) or Outbound (false)\n" + " \"addnode\" : true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection\n" + " \"startingheight\" : n, (numeric) The starting height (block) of the peer\n" + " \"banscore\" : n, (numeric) The ban score\n" + " \"synced_headers\" : n, (numeric) The last header we have in common with this peer\n" + " \"synced_blocks\" : n, (numeric) The last block we have in common with this peer\n" + " \"inflight\" : [\n" " n, (numeric) The heights of blocks we're currently asking from this peer\n" " ...\n" " ],\n" - " \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n" - " \"minfeefilter\": n, (numeric) The minimum fee rate for transactions this peer accepts\n" - " \"bytessent_per_msg\": {\n" - " \"msg\": n, (numeric) The total bytes sent aggregated by message type\n" + " \"whitelisted\" : true|false, (boolean) Whether the peer is whitelisted\n" + " \"minfeefilter\" : n, (numeric) The minimum fee rate for transactions this peer accepts\n" + " \"bytessent_per_msg\" : {\n" + " \"msg\" : n, (numeric) The total bytes sent aggregated by message type\n" " When a message type is not listed in this json object, the bytes sent are 0.\n" " Only known message types can appear as keys in the object.\n" " ...\n" " },\n" - " \"bytesrecv_per_msg\": {\n" - " \"msg\": n, (numeric) The total bytes received aggregated by message type\n" + " \"bytesrecv_per_msg\" : {\n" + " \"msg\" : n, (numeric) The total bytes received aggregated by message type\n" " When a message type is not listed in this json object, the bytes received are 0.\n" " Only known message types can appear as keys in the object and all bytes received of unknown message types are listed under '"+NET_MESSAGE_COMMAND_OTHER+"'.\n" " ...\n" @@ -152,6 +153,9 @@ static UniValue getpeerinfo(const JSONRPCRequest& request) obj.pushKV("addrlocal", stats.addrLocal); if (stats.addrBind.IsValid()) obj.pushKV("addrbind", stats.addrBind.ToString()); + if (stats.m_mapped_as != 0) { + obj.pushKV("mapped_as", uint64_t(stats.m_mapped_as)); + } obj.pushKV("services", strprintf("%016x", stats.nServices)); obj.pushKV("servicesnames", GetServicesNames(stats.nServices)); obj.pushKV("relaytxes", stats.fRelayTxes); @@ -383,17 +387,17 @@ static UniValue getnettotals(const JSONRPCRequest& request) {}, RPCResult{ "{\n" - " \"totalbytesrecv\": n, (numeric) Total bytes received\n" - " \"totalbytessent\": n, (numeric) Total bytes sent\n" - " \"timemillis\": t, (numeric) Current UNIX time in milliseconds\n" - " \"uploadtarget\":\n" + " \"totalbytesrecv\" : n, (numeric) Total bytes received\n" + " \"totalbytessent\" : n, (numeric) Total bytes sent\n" + " \"timemillis\" : t, (numeric) Current UNIX time in milliseconds\n" + " \"uploadtarget\" : \n" " {\n" - " \"timeframe\": n, (numeric) Length of the measuring timeframe in seconds\n" - " \"target\": n, (numeric) Target in bytes\n" - " \"target_reached\": true|false, (boolean) True if target is reached\n" - " \"serve_historical_blocks\": true|false, (boolean) True if serving historical blocks\n" - " \"bytes_left_in_cycle\": t, (numeric) Bytes left in current time cycle\n" - " \"time_left_in_cycle\": t (numeric) Seconds left in current time cycle\n" + " \"timeframe\" : n, (numeric) Length of the measuring timeframe in seconds\n" + " \"target\" : n, (numeric) Target in bytes\n" + " \"target_reached\" : true|false, (boolean) True if target is reached\n" + " \"serve_historical_blocks\" : true|false, (boolean) True if serving historical blocks\n" + " \"bytes_left_in_cycle\" : t, (numeric) Bytes left in current time cycle\n" + " \"time_left_in_cycle\" : t (numeric) Seconds left in current time cycle\n" " }\n" "}\n" }, @@ -448,40 +452,40 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request) "Returns an object containing various state info regarding P2P networking.\n", {}, RPCResult{ - "{\n" - " \"version\": xxxxx, (numeric) the server version\n" - " \"subversion\": \"/Satoshi:x.x.x/\", (string) the server subversion string\n" - " \"protocolversion\": xxxxx, (numeric) the protocol version\n" - " \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n" - " \"localservicesnames\": [ (array) the services we offer to the network, in human-readable form\n" + "{ (json object)\n" + " \"version\" : xxxxx, (numeric) the server version\n" + " \"subversion\" : \"str\", (string) the server subversion string\n" + " \"protocolversion\" : xxxxx, (numeric) the protocol version\n" + " \"localservices\" : \"hex\", (string) the services we offer to the network\n" + " \"localservicesnames\" : [ (json array) the services we offer to the network, in human-readable form\n" " \"SERVICE_NAME\", (string) the service name\n" " ...\n" " ],\n" - " \"localrelay\": true|false, (bool) true if transaction relay is requested from peers\n" - " \"timeoffset\": xxxxx, (numeric) the time offset\n" - " \"connections\": xxxxx, (numeric) the number of connections\n" - " \"networkactive\": true|false, (bool) whether p2p networking is enabled\n" - " \"networks\": [ (array) information per network\n" - " {\n" - " \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n" - " \"limited\": true|false, (boolean) is the network limited using -onlynet?\n" - " \"reachable\": true|false, (boolean) is the network reachable?\n" - " \"proxy\": \"host:port\" (string) the proxy that is used for this network, or empty if none\n" - " \"proxy_randomize_credentials\": true|false, (string) Whether randomized credentials are used\n" - " }\n" - " ,...\n" + " \"localrelay\" : true|false, (boolean) true if transaction relay is requested from peers\n" + " \"timeoffset\" : xxxxx, (numeric) the time offset\n" + " \"connections\" : xxxxx, (numeric) the number of connections\n" + " \"networkactive\" : true|false, (boolean) whether p2p networking is enabled\n" + " \"networks\" : [ (json array) information per network\n" + " { (json object)\n" + " \"name\" : \"str\", (string) network (ipv4, ipv6 or onion)\n" + " \"limited\" : true|false, (boolean) is the network limited using -onlynet?\n" + " \"reachable\" : true|false, (boolean) is the network reachable?\n" + " \"proxy\" : \"str\" (string) (\"host:port\") the proxy that is used for this network, or empty if none\n" + " \"proxy_randomize_credentials\" : true|false, (boolean) Whether randomized credentials are used\n" + " },\n" + " ...\n" " ],\n" - " \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n" - " \"incrementalfee\": x.xxxxxxxx, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in " + CURRENCY_UNIT + "/kB\n" - " \"localaddresses\": [ (array) list of local addresses\n" - " {\n" - " \"address\": \"xxxx\", (string) network address\n" - " \"port\": xxx, (numeric) network port\n" - " \"score\": xxx (numeric) relative score\n" - " }\n" - " ,...\n" - " ]\n" - " \"warnings\": \"...\" (string) any network and blockchain warnings\n" + " \"relayfee\" : x.xxxxxxxx, (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n" + " \"incrementalfee\" : x.xxxxxxxx, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in " + CURRENCY_UNIT + "/kB\n" + " \"localaddresses\" : [ (json array) list of local addresses\n" + " { (json object)\n" + " \"address\" : \"xxxx\", (string) network address\n" + " \"port\" : xxx, (numeric) network port\n" + " \"score\" : xxx (numeric) relative score\n" + " },\n" + " ...\n" + " ],\n" + " \"warnings\" : \"str\", (string) any network and blockchain warnings\n" "}\n" }, RPCExamples{ @@ -562,11 +566,11 @@ static UniValue setban(const JSONRPCRequest& request) if (!isSubnet) { CNetAddr resolved; - LookupHost(request.params[0].get_str().c_str(), resolved, false); + LookupHost(request.params[0].get_str(), resolved, false); netAddr = resolved; } else - LookupSubNet(request.params[0].get_str().c_str(), subNet); + LookupSubNet(request.params[0].get_str(), subNet); if (! (isSubnet ? subNet.IsValid() : netAddr.IsValid()) ) throw JSONRPCError(RPC_CLIENT_INVALID_IP_OR_SUBNET, "Error: Invalid IP/Subnet"); @@ -691,10 +695,10 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request) RPCResult{ "[\n" " {\n" - " \"time\": ttt, (numeric) The " + UNIX_EPOCH_TIME + " of when the node was last seen\n" - " \"services\": n, (numeric) The services offered\n" - " \"address\": \"host\", (string) The address of the node\n" - " \"port\": n (numeric) The port of the node\n" + " \"time\" : ttt, (numeric) The " + UNIX_EPOCH_TIME + " of when the node was last seen\n" + " \"services\" : n, (numeric) The services offered\n" + " \"address\" : \"host\", (string) The address of the node\n" + " \"port\" : n (numeric) The port of the node\n" " }\n" " ,....\n" "]\n" diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 5be7acce1c..cd1c657c26 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -98,7 +98,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) }, RPCResult{"if verbose is set to true", "{\n" - " \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n" + " \"in_active_chain\" : b, (boolean) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n" " \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n" " \"txid\" : \"id\", (string) The transaction id (same as provided)\n" " \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n" @@ -109,14 +109,14 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) " \"locktime\" : ttt, (numeric) The lock time\n" " \"vin\" : [ (array of json objects)\n" " {\n" - " \"txid\": \"id\", (string) The transaction id\n" - " \"vout\": n, (numeric) \n" - " \"scriptSig\": { (json object) The script\n" - " \"asm\": \"asm\", (string) asm\n" - " \"hex\": \"hex\" (string) hex\n" + " \"txid\" : \"id\", (string) The transaction id\n" + " \"vout\" : n, (numeric) \n" + " \"scriptSig\" : { (json object) The script\n" + " \"asm\" : \"asm\", (string) asm\n" + " \"hex\" : \"hex\" (string) hex\n" " },\n" - " \"sequence\": n (numeric) The script sequence number\n" - " \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" + " \"sequence\" : n (numeric) The script sequence number\n" + " \"txinwitness\" : [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" " }\n" " ,...\n" " ],\n" @@ -442,14 +442,14 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request) " \"locktime\" : ttt, (numeric) The lock time\n" " \"vin\" : [ (array of json objects)\n" " {\n" - " \"txid\": \"id\", (string) The transaction id\n" - " \"vout\": n, (numeric) The output number\n" - " \"scriptSig\": { (json object) The script\n" - " \"asm\": \"asm\", (string) asm\n" - " \"hex\": \"hex\" (string) hex\n" + " \"txid\" : \"id\", (string) The transaction id\n" + " \"vout\" : n, (numeric) The output number\n" + " \"scriptSig\" : { (json object) The script\n" + " \"asm\" : \"asm\", (string) asm\n" + " \"hex\" : \"hex\" (string) hex\n" " },\n" - " \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" - " \"sequence\": n (numeric) The script sequence number\n" + " \"txinwitness\" : [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" + " \"sequence\" : n (numeric) The script sequence number\n" " }\n" " ,...\n" " ],\n" @@ -514,20 +514,20 @@ static UniValue decodescript(const JSONRPCRequest& request) }, RPCResult{ "{\n" - " \"asm\":\"asm\", (string) Script public key\n" - " \"type\":\"type\", (string) The output type (e.g. "+GetAllOutputTypes()+")\n" - " \"reqSigs\": n, (numeric) The required signatures\n" - " \"addresses\": [ (json array of string)\n" + " \"asm\" : \"asm\", (string) Script public key\n" + " \"type\" : \"type\", (string) The output type (e.g. "+GetAllOutputTypes()+")\n" + " \"reqSigs\" : n, (numeric) The required signatures\n" + " \"addresses\" : [ (json array of string)\n" " \"address\" (string) bitcoin address\n" " ,...\n" " ],\n" " \"p2sh\":\"str\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n" - " \"segwit\": { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness).\n" - " \"asm\":\"str\", (string) String representation of the script public key\n" - " \"hex\":\"hexstr\", (string) Hex string of the script public key\n" - " \"type\":\"str\", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)\n" - " \"reqSigs\": n, (numeric) The required signatures (always 1)\n" - " \"addresses\": [ (json array of string) (always length 1)\n" + " \"segwit\" : { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness).\n" + " \"asm\" : \"str\", (string) String representation of the script public key\n" + " \"hex\" : \"hexstr\", (string) Hex string of the script public key\n" + " \"type\" : \"str\", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)\n" + " \"reqSigs\" : n, (numeric) The required signatures (always 1)\n" + " \"addresses\" : [ (json array of string) (always length 1)\n" " \"address\" (string) segwit address\n" " ,...\n" " ],\n" @@ -846,7 +846,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request) {"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK()), "Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kB\n"}, }, RPCResult{ - "[ (array) The result of the mempool acceptance test for each raw transaction in the input array.\n" + "[ (json array) The result of the mempool acceptance test for each raw transaction in the input array.\n" " Length is exactly one for now.\n" " {\n" " \"txid\" (string) The transaction hash in hex\n" @@ -998,7 +998,7 @@ UniValue decodepsbt(const JSONRPCRequest& request) " \"asm\" : \"asm\", (string) The asm\n" " \"hex\" : \"hex\", (string) The hex\n" " }\n" - " \"final_scriptwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" + " \"final_scriptwitness\" : [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" " \"unknown\" : { (json object) The unknown global fields\n" " \"key\" : \"value\" (key-value pair) An unknown key-value pair\n" " ...\n" @@ -1079,7 +1079,12 @@ UniValue decodepsbt(const JSONRPCRequest& request) UniValue out(UniValue::VOBJ); out.pushKV("amount", ValueFromAmount(txout.nValue)); - total_in += txout.nValue; + if (MoneyRange(txout.nValue) && MoneyRange(total_in + txout.nValue)) { + total_in += txout.nValue; + } else { + // Hack to just not show fee later + have_all_utxos = false; + } UniValue o(UniValue::VOBJ); ScriptToUniv(txout.scriptPubKey, o, true); @@ -1089,7 +1094,13 @@ UniValue decodepsbt(const JSONRPCRequest& request) UniValue non_wit(UniValue::VOBJ); TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false); in.pushKV("non_witness_utxo", non_wit); - total_in += input.non_witness_utxo->vout[psbtx.tx->vin[i].prevout.n].nValue; + CAmount utxo_val = input.non_witness_utxo->vout[psbtx.tx->vin[i].prevout.n].nValue; + if (MoneyRange(utxo_val) && MoneyRange(total_in + utxo_val)) { + total_in += utxo_val; + } else { + // Hack to just not show fee later + have_all_utxos = false; + } } else { have_all_utxos = false; } @@ -1205,7 +1216,12 @@ UniValue decodepsbt(const JSONRPCRequest& request) outputs.push_back(out); // Fee calculation - output_value += psbtx.tx->vout[i].nValue; + if (MoneyRange(psbtx.tx->vout[i].nValue) && MoneyRange(output_value + psbtx.tx->vout[i].nValue)) { + output_value += psbtx.tx->vout[i].nValue; + } else { + // Hack to just not show fee later + have_all_utxos = false; + } } result.pushKV("outputs", outputs); if (have_all_utxos) { @@ -1276,11 +1292,10 @@ UniValue finalizepsbt(const JSONRPCRequest& request) " extract and return the complete transaction in normal network serialization instead of the PSBT."}, }, RPCResult{ - "{\n" - " \"psbt\" : \"value\", (string) The base64-encoded partially signed transaction if not extracted\n" - " \"hex\" : \"value\", (string) The hex-encoded network transaction if extracted\n" - " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n" - " ]\n" + "{ (json object)\n" + " \"psbt\" : \"str\", (string) The base64-encoded partially signed transaction if not extracted\n" + " \"hex\" : \"hex\", (string) The hex-encoded network transaction if extracted\n" + " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n" "}\n" }, RPCExamples{ diff --git a/src/rpc/rawtransaction_util.h b/src/rpc/rawtransaction_util.h index e70446d7f1..4750fd64ed 100644 --- a/src/rpc/rawtransaction_util.h +++ b/src/rpc/rawtransaction_util.h @@ -28,7 +28,7 @@ void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, /** * Parse a prevtxs UniValue array and get the map of coins from it * - * @param prevTxs Array of previous txns outputs that tx depends on but may not yet be in the block chain + * @param prevTxsUnival Array of previous txns outputs that tx depends on but may not yet be in the block chain * @param keystore A pointer to the temporary keystore if there is one * @param coins Map of unspent outputs - coins in mempool and current chain UTXO set, may be extended by previous txns outputs after call */ diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 91d3e1fca4..b62490ed29 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2019 The Bitcoin Core developers +// Copyright (c) 2009-2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -18,7 +18,7 @@ #include <memory> // for unique_ptr #include <unordered_map> -static CCriticalSection cs_rpcWarmup; +static RecursiveMutex cs_rpcWarmup; static std::atomic<bool> g_rpc_running{false}; static bool fRPCInWarmup GUARDED_BY(cs_rpcWarmup) = true; static std::string rpcWarmupStatus GUARDED_BY(cs_rpcWarmup) = "RPC server started"; @@ -198,14 +198,14 @@ static UniValue getrpcinfo(const JSONRPCRequest& request) {}, RPCResult{ "{\n" - " \"active_commands\" (array) All active commands\n" + " \"active_commands\" (json array) All active commands\n" " [\n" - " { (object) Information about an active command\n" + " { (json object) Information about an active command\n" " \"method\" (string) The name of the RPC command \n" " \"duration\" (numeric) The running time in microseconds\n" " },...\n" " ],\n" - " \"logpath\": \"xxx\" (string) The complete file path to the debug log\n" + " \"logpath\" : \"xxx\" (string) The complete file path to the debug log\n" "}\n" }, RPCExamples{ |