refactor: remove unnecessary AppendWarning helper function

This commit is contained in:
stickies-v 2024-04-18 12:29:04 +01:00
parent ff21eb2def
commit bed29c481a
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757

View file

@ -31,10 +31,10 @@
#include <logging/timer.h>
#include <node/blockstorage.h>
#include <node/utxo_snapshot.h>
#include <policy/v3_policy.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <policy/settings.h>
#include <policy/v3_policy.h>
#include <pow.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
@ -57,6 +57,7 @@
#include <util/result.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/time.h>
#include <util/trace.h>
#include <util/translation.h>
@ -2847,13 +2848,6 @@ void Chainstate::PruneAndFlush()
}
}
/** Private helper function that concatenates warning messages. */
static void AppendWarning(bilingual_str& res, const bilingual_str& warn)
{
if (!res.empty()) res += Untranslated(", ");
res += warn;
}
static void UpdateTipLog(
const CCoinsViewCache& coins_tip,
const CBlockIndex* tip,
@ -2904,7 +2898,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
g_best_block_cv.notify_all();
}
bilingual_str warning_messages;
std::vector<bilingual_str> warning_messages;
if (!m_chainman.IsInitialBlockDownload()) {
const CBlockIndex* pindex = pindexNew;
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
@ -2915,12 +2909,13 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
if (state == ThresholdState::ACTIVE) {
m_chainman.GetNotifications().warning(warning);
} else {
AppendWarning(warning_messages, warning);
warning_messages.push_back(warning);
}
}
}
}
UpdateTipLog(coins_tip, pindexNew, params, __func__, "", warning_messages.original);
UpdateTipLog(coins_tip, pindexNew, params, __func__, "",
util::Join(warning_messages, Untranslated(", ")).original);
}
/** Disconnect m_chain's tip.