Skip to content

Commit bed29c4

Browse files
committed
refactor: remove unnecessary AppendWarning helper function
1 parent ff21eb2 commit bed29c4

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/validation.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include <logging/timer.h>
3232
#include <node/blockstorage.h>
3333
#include <node/utxo_snapshot.h>
34-
#include <policy/v3_policy.h>
3534
#include <policy/policy.h>
3635
#include <policy/rbf.h>
3736
#include <policy/settings.h>
37+
#include <policy/v3_policy.h>
3838
#include <pow.h>
3939
#include <primitives/block.h>
4040
#include <primitives/transaction.h>
@@ -57,6 +57,7 @@
5757
#include <util/result.h>
5858
#include <util/signalinterrupt.h>
5959
#include <util/strencodings.h>
60+
#include <util/string.h>
6061
#include <util/time.h>
6162
#include <util/trace.h>
6263
#include <util/translation.h>
@@ -2847,13 +2848,6 @@ void Chainstate::PruneAndFlush()
28472848
}
28482849
}
28492850

2850-
/** Private helper function that concatenates warning messages. */
2851-
static void AppendWarning(bilingual_str& res, const bilingual_str& warn)
2852-
{
2853-
if (!res.empty()) res += Untranslated(", ");
2854-
res += warn;
2855-
}
2856-
28572851
static void UpdateTipLog(
28582852
const CCoinsViewCache& coins_tip,
28592853
const CBlockIndex* tip,
@@ -2904,7 +2898,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
29042898
g_best_block_cv.notify_all();
29052899
}
29062900

2907-
bilingual_str warning_messages;
2901+
std::vector<bilingual_str> warning_messages;
29082902
if (!m_chainman.IsInitialBlockDownload()) {
29092903
const CBlockIndex* pindex = pindexNew;
29102904
for (int bit = 0; bit < VERSIONBITS_NUM_BITS; bit++) {
@@ -2915,12 +2909,13 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
29152909
if (state == ThresholdState::ACTIVE) {
29162910
m_chainman.GetNotifications().warning(warning);
29172911
} else {
2918-
AppendWarning(warning_messages, warning);
2912+
warning_messages.push_back(warning);
29192913
}
29202914
}
29212915
}
29222916
}
2923-
UpdateTipLog(coins_tip, pindexNew, params, __func__, "", warning_messages.original);
2917+
UpdateTipLog(coins_tip, pindexNew, params, __func__, "",
2918+
util::Join(warning_messages, Untranslated(", ")).original);
29242919
}
29252920

29262921
/** Disconnect m_chain's tip.

0 commit comments

Comments
 (0)