MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / gettxoutsetinfo

Function gettxoutsetinfo

src/rpc/blockchain.cpp:1014–1054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1012}
1013
1014static UniValue gettxoutsetinfo(const JSONRPCRequest& request)
1015{
1016 if (request.fHelp || request.params.size() != 0)
1017 throw std::runtime_error(
1018 "gettxoutsetinfo\n"
1019 "\nReturns statistics about the unspent transaction output set.\n"
1020 "Note this call may take some time.\n"
1021 "\nResult:\n"
1022 "{\n"
1023 " \"height\":n, (numeric) The current block height (index)\n"
1024 " \"bestblock\": \"hex\", (string) The hash of the block at the tip of the chain\n"
1025 " \"transactions\": n, (numeric) The number of transactions with unspent outputs\n"
1026 " \"txouts\": n, (numeric) The number of unspent transaction outputs\n"
1027 " \"bogosize\": n, (numeric) A meaningless metric for UTXO set size\n"
1028 " \"hash_serialized_2\": \"hash\", (string) The serialized hash\n"
1029 " \"disk_size\": n, (numeric) The estimated size of the chainstate on disk\n"
1030 " \"total_amount\": x.xxx (numeric) The total amount\n"
1031 "}\n"
1032 "\nExamples:\n"
1033 + HelpExampleCli("gettxoutsetinfo", "")
1034 + HelpExampleRpc("gettxoutsetinfo", "")
1035 );
1036
1037 UniValue ret(UniValue::VOBJ);
1038
1039 CCoinsStats stats;
1040 FlushStateToDisk();
1041 if (GetUTXOStats(pcoinsdbview.get(), stats)) {
1042 ret.pushKV("height", (int64_t)stats.nHeight);
1043 ret.pushKV("bestblock", stats.hashBlock.GetHex());
1044 ret.pushKV("transactions", (int64_t)stats.nTransactions);
1045 ret.pushKV("txouts", (int64_t)stats.nTransactionOutputs);
1046 ret.pushKV("bogosize", (int64_t)stats.nBogoSize);
1047 ret.pushKV("hash_serialized_2", stats.hashSerialized.GetHex());
1048 ret.pushKV("disk_size", stats.nDiskSize);
1049 ret.pushKV("total_amount", ValueFromAmount(stats.nTotalAmount));
1050 } else {
1051 throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set");
1052 }
1053 return ret;
1054}
1055
1056UniValue gettxout(const JSONRPCRequest& request)
1057{

Callers

nothing calls this directly

Calls 10

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
FlushStateToDiskFunction · 0.85
GetUTXOStatsFunction · 0.85
ValueFromAmountFunction · 0.85
JSONRPCErrorFunction · 0.85
getMethod · 0.80
sizeMethod · 0.45
pushKVMethod · 0.45
GetHexMethod · 0.45

Tested by

no test coverage detected