From 3c914d58ff323255b32e717d0ce28209ec0abdaa Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Fri, 24 Jan 2020 18:58:47 +0100 Subject: index: Coinstats index can be activated with command line flag --- src/rpc/blockchain.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/rpc') 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 #include #include +#include #include #include #include @@ -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; -- cgit v1.2.3