diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -45,7 +45,6 @@ #include #include -#include #include #include // boost::this_thread::interruption_point() (mingw) @@ -2109,6 +2108,14 @@ 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. @@ -2128,7 +2135,7 @@ g_best_block_cv.notify_all(); } - std::vector warningMessages; + std::string warningMessages; if (!IsInitialBlockDownload()) { int nUpgraded = 0; const CBlockIndex *pindex = chainActive.Tip(); @@ -2145,8 +2152,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 " @@ -2161,8 +2170,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"); }