@@ -64,6 +64,10 @@ CCriticalSection cs_ScraperGlobals;
64
64
* file side.
65
65
*/
66
66
CCriticalSection cs_StructScraperFileManifest;
67
+ /* *
68
+ * @brief Protects access to the ConvergedStats.csv.gz compressed statistics map output file.
69
+ */
70
+ CCriticalSection cs_ConvergedStats;
67
71
/* *
68
72
* @brief Protects the global converged scraper stats cache, which is populated by periodic runs of the scraper and/or
69
73
* subscriber loop, and is used to validate superblocks.
@@ -3452,6 +3456,8 @@ bool StoreScraperFileManifest(const fs::path& file)
3452
3456
3453
3457
bool StoreStats (const fs::path& file, const ScraperStats& mScraperStats )
3454
3458
{
3459
+ LOCK (cs_ConvergedStats);
3460
+
3455
3461
if (fs::exists (file))
3456
3462
fs::remove (file);
3457
3463
@@ -6069,13 +6075,13 @@ UniValue testnewsb(const UniValue& params, bool fHelp)
6069
6075
{
6070
6076
LOCK (cs_ConvergedScraperStatsCache);
6071
6077
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." );
6076
6082
6077
- return error;
6078
- }
6083
+ return error;
6084
+ }
6079
6085
6080
6086
_log (logattribute::INFO, " testnewsb" ,
6081
6087
" Size of the PastConvergences map = " + ToString (ConvergedScraperStatsCache.PastConvergences .size ()));
0 commit comments