@@ -64,6 +64,10 @@ CCriticalSection cs_ScraperGlobals;
6464 * file side.
6565 */
6666CCriticalSection cs_StructScraperFileManifest;
67+ /* *
68+ * @brief Protects access to the ConvergedStats.csv.gz compressed statistics map output file.
69+ */
70+ CCriticalSection cs_ConvergedStats;
6771/* *
6872 * @brief Protects the global converged scraper stats cache, which is populated by periodic runs of the scraper and/or
6973 * subscriber loop, and is used to validate superblocks.
@@ -3452,6 +3456,8 @@ bool StoreScraperFileManifest(const fs::path& file)
34523456
34533457bool StoreStats (const fs::path& file, const ScraperStats& mScraperStats )
34543458{
3459+ LOCK (cs_ConvergedStats);
3460+
34553461 if (fs::exists (file))
34563462 fs::remove (file);
34573463
@@ -6069,13 +6075,13 @@ UniValue testnewsb(const UniValue& params, bool fHelp)
60696075 {
60706076 LOCK (cs_ConvergedScraperStatsCache);
60716077
6072- if (!ConvergedScraperStatsCache.NewFormatSuperblock .WellFormed ())
6073- {
6074- UniValue error (UniValue::VOBJ);
6075- error.pushKV (" Error:" , " Wait until a convergence is formed." );
6078+ if (!ConvergedScraperStatsCache.NewFormatSuperblock .WellFormed ())
6079+ {
6080+ UniValue error (UniValue::VOBJ);
6081+ error.pushKV (" Error:" , " Wait until a convergence is formed." );
60766082
6077- return error;
6078- }
6083+ return error;
6084+ }
60796085
60806086 _log (logattribute::INFO, " testnewsb" ,
60816087 " Size of the PastConvergences map = " + ToString (ConvergedScraperStatsCache.PastConvergences .size ()));
0 commit comments