fix: do not crash when running with statsenabled=1 (#5066)

This commit is contained in:
UdjinM6 2022-11-01 08:30:54 +03:00 committed by GitHub
parent 55332c931a
commit 468769f9ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -989,7 +989,7 @@ void PeriodicStats(ArgsManager& args)
assert(args.GetBoolArg("-statsenabled", DEFAULT_STATSD_ENABLE));
CCoinsStats stats;
::ChainstateActive().ForceFlushStateToDisk();
if (WITH_LOCK(cs_main, return GetUTXOStats(&::ChainstateActive().CoinsDB(), stats, CoinStatsHashType::NONE))) {
if (WITH_LOCK(cs_main, return GetUTXOStats(&::ChainstateActive().CoinsDB(), stats, CoinStatsHashType::NONE, boost::this_thread::interruption_point))) {
statsClient.gauge("utxoset.tx", stats.nTransactions, 1.0f);
statsClient.gauge("utxoset.txOutputs", stats.nTransactionOutputs, 1.0f);
statsClient.gauge("utxoset.dbSizeBytes", stats.nDiskSize, 1.0f);