diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2107,6 +2107,12 @@ FlushStateToDisk(chainparams, state, FlushStateMode::NONE); } +/** Private helper function that concatenates warning messages. */ +static void AppendWarning(std::string &res, const std::string &warn) { + if (!res.empty()) res += ", "; + res += warn; +} + /** * Update chainActive and related internal data structures when adding a new * block to the chain tip. @@ -2126,7 +2132,7 @@ g_best_block_cv.notify_all(); } - std::vector warningMessages; + std::string warningMessages; if (!IsInitialBlockDownload()) { int nUpgraded = 0; const CBlockIndex *pindex = chainActive.Tip(); @@ -2143,8 +2149,10 @@ pindex = pindex->pprev; } if (nUpgraded > 0) { - warningMessages.push_back(strprintf( - _("%d of last 100 blocks have unexpected version"), nUpgraded)); + AppendWarning( + warningMessages, + strprintf(_("%d of last 100 blocks have unexpected version"), + nUpgraded)); } } LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8g tx=%lu " @@ -2159,8 +2167,7 @@ pcoinsTip->DynamicMemoryUsage() * (1.0 / (1 << 20)), pcoinsTip->GetCacheSize()); if (!warningMessages.empty()) { - LogPrintf(" warning='%s'", - boost::algorithm::join(warningMessages, ", ")); + LogPrintf(" warning='%s'", warningMessages); } LogPrintf("\n"); }