diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2021-02-28 19:27:00 +0100 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2021-04-19 21:11:33 +0200 |
commit | b9362392aef2689bc106c20925859ede555d082b (patch) | |
tree | b8437b8db02cfe99a5d0626bdf16b6699b477eaf /src/rpc/blockchain.cpp | |
parent | bb7788b121a30489bc81a1f46dde6a9b19ae4ec1 (diff) | |
download | bitcoin-b9362392aef2689bc106c20925859ede555d082b.tar.xz |
index, rpc: Add use_index option for gettxoutsetinfo
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r-- | src/rpc/blockchain.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 1067a7c4bb..4a4c432a01 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1102,6 +1102,7 @@ static RPCHelpMan gettxoutsetinfo() { {"hash_type", RPCArg::Type::STR, RPCArg::Default{"hash_serialized_2"}, "Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'muhash', 'none'."}, {"hash_or_height", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The block hash or height of the target height (only available with coinstatsindex)", "", {"", "string or numeric"}}, + {"use_index", RPCArg::Type::BOOL, RPCArg::Default{true}, "Use coinstatsindex, if available."}, }, RPCResult{ RPCResult::Type::OBJ, "", "", @@ -1148,6 +1149,7 @@ static RPCHelpMan gettxoutsetinfo() CBlockIndex* pindex{nullptr}; const CoinStatsHashType hash_type{request.params[0].isNull() ? CoinStatsHashType::HASH_SERIALIZED : ParseHashType(request.params[0].get_str())}; CCoinsStats stats{hash_type}; + stats.index_requested = request.params[2].isNull() || request.params[2].get_bool(); NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); @@ -1183,7 +1185,7 @@ static RPCHelpMan gettxoutsetinfo() ret.pushKV("muhash", stats.hashSerialized.GetHex()); } ret.pushKV("total_amount", ValueFromAmount(stats.nTotalAmount)); - if (!stats.from_index) { + if (!stats.index_used) { ret.pushKV("transactions", static_cast<int64_t>(stats.nTransactions)); ret.pushKV("disk_size", stats.nDiskSize); } else { |