Report on-disk size in gettxoutsetinfo
This commit is contained in:
@@ -782,6 +782,7 @@ struct CCoinsStats
|
||||
uint64_t nTransactions;
|
||||
uint64_t nTransactionOutputs;
|
||||
uint256 hashSerialized;
|
||||
uint64_t nDiskSize;
|
||||
CAmount nTotalAmount;
|
||||
|
||||
CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nTotalAmount(0) {}
|
||||
@@ -826,6 +827,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
|
||||
}
|
||||
stats.hashSerialized = ss.GetHash();
|
||||
stats.nTotalAmount = nTotalAmount;
|
||||
stats.nDiskSize = view->EstimateSize();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -892,6 +894,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
||||
" \"transactions\": n, (numeric) The number of transactions\n"
|
||||
" \"txouts\": n, (numeric) The number of output transactions\n"
|
||||
" \"hash_serialized\": \"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"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
@@ -909,6 +912,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
||||
ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
|
||||
ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
|
||||
ret.push_back(Pair("hash_serialized_2", stats.hashSerialized.GetHex()));
|
||||
ret.push_back(Pair("disk_size", stats.nDiskSize));
|
||||
ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
|
||||
} else {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set");
|
||||
|
||||
Reference in New Issue
Block a user