diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2020-01-24 18:58:47 +0100 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2021-04-19 20:28:48 +0200 |
commit | 3c914d58ff323255b32e717d0ce28209ec0abdaa (patch) | |
tree | 34187e016ca1869013b06f76027cbdd624263e45 /src/rpc | |
parent | dd58a4de21469d6d848ae309edc47f558628221d (diff) | |
download | bitcoin-3c914d58ff323255b32e717d0ce28209ec0abdaa.tar.xz |
index: Coinstats index can be activated with command line flag
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/blockchain.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index e06f4ec15b..dc6b7930b9 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -14,6 +14,7 @@ #include <core_io.h> #include <hash.h> #include <index/blockfilterindex.h> +#include <index/coinstatsindex.h> #include <node/blockstorage.h> #include <node/coinstats.h> #include <node/context.h> @@ -1124,6 +1125,13 @@ static RPCHelpMan gettxoutsetinfo() ret.pushKV("disk_size", stats.nDiskSize); ret.pushKV("total_amount", ValueFromAmount(stats.nTotalAmount)); } else { + if (g_coin_stats_index) { + const IndexSummary summary{g_coin_stats_index->GetSummary()}; + + if (!summary.synced) { + throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to read UTXO set because coinstatsindex is still syncing. Current height: %d", summary.best_block_height)); + } + } throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set"); } return ret; |