aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-06-25 17:02:59 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-09-09 00:51:31 +0100
commitfc0c410d6e19dd8e3abbc9b0fc13c836e6678750 (patch)
treec6bfe923830a0530b77ec5e37416b389d5938407 /src/rpc
parent332c6134bb15384e5b91c631e821fe52a591d3bc (diff)
downloadbitcoin-fc0c410d6e19dd8e3abbc9b0fc13c836e6678750.tar.xz
rpc: Improve scantxoutset response and help message
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 50c4589d9f..8a541ecde1 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -2199,17 +2199,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"
- " {\n"
- " \"txid\" : \"transactionid\", (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"
+ " \"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"
+ " ,...],\n"
+ " \"total_amount\": x.xxx, (numeric) The total amount of all found unspent outputs in " + CURRENCY_UNIT + "\n"
"]\n"
},
RPCExamples{""},
@@ -2293,15 +2297,20 @@ UniValue scantxoutset(const JSONRPCRequest& request)
g_scan_progress = 0;
int64_t count = 0;
std::unique_ptr<CCoinsViewCursor> pcursor;
+ CBlockIndex* tip;
{
LOCK(cs_main);
::ChainstateActive().ForceFlushStateToDisk();
pcursor = std::unique_ptr<CCoinsViewCursor>(pcoinsdbview->Cursor());
assert(pcursor);
+ tip = ::ChainActive().Tip();
+ assert(tip);
}
bool res = FindScriptPubKey(g_scan_progress, g_should_abort_scan, count, pcursor.get(), needles, coins);
result.pushKV("success", res);
- result.pushKV("searched_items", count);
+ result.pushKV("txouts", count);
+ result.pushKV("height", tip->nHeight);
+ result.pushKV("bestblock", tip->GetBlockHash().GetHex());
for (const auto& it : coins) {
const COutPoint& outpoint = it.first;