Skip to content

Commit e2746db

Browse files
committed
Merge #13016: scripted-diff: Rename CChainState::g_failed_blocks to m_failed_blocks
3cc9094 scripted-diff: Rename CChainState::g_failed_blocks to m_failed_blocks (Ben Woosley) Pull request description: To reflect its actual status as a member rather than a global value. g_failed_blocks was previously global: 2862aca Tree-SHA512: a0e679a151e0fb70d245a7a1821449d0a4738f5ba503abca9f19d9cfbcbb0e72a1598e3364e29775b0c203acd6d04d882d2788208f685edc57aaba5e946fde3b
2 parents 65d7083 + 3cc9094 commit e2746db

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/validation.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CChainState {
142142
* ahead and mark descendants of invalid blocks as FAILED_CHILD at that time,
143143
* instead of putting things in this set.
144144
*/
145-
std::set<CBlockIndex*> g_failed_blocks;
145+
std::set<CBlockIndex*> m_failed_blocks;
146146

147147
public:
148148
CChain chainActive;
@@ -1286,7 +1286,7 @@ void static InvalidChainFound(CBlockIndex* pindexNew)
12861286
void CChainState::InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state) {
12871287
if (!state.CorruptionPossible()) {
12881288
pindex->nStatus |= BLOCK_FAILED_VALID;
1289-
g_failed_blocks.insert(pindex);
1289+
m_failed_blocks.insert(pindex);
12901290
setDirtyBlockIndex.insert(pindex);
12911291
setBlockIndexCandidates.erase(pindex);
12921292
InvalidChainFound(pindex);
@@ -2803,7 +2803,7 @@ bool CChainState::InvalidateBlock(CValidationState& state, const CChainParams& c
28032803
pindex->nStatus |= BLOCK_FAILED_VALID;
28042804
setDirtyBlockIndex.insert(pindex);
28052805
setBlockIndexCandidates.erase(pindex);
2806-
g_failed_blocks.insert(pindex);
2806+
m_failed_blocks.insert(pindex);
28072807

28082808
// DisconnectTip will add transactions to disconnectpool; try to add these
28092809
// back to the mempool.
@@ -2849,7 +2849,7 @@ bool CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
28492849
// Reset invalid block marker if it was pointing to one of those.
28502850
pindexBestInvalid = nullptr;
28512851
}
2852-
g_failed_blocks.erase(it->second);
2852+
m_failed_blocks.erase(it->second);
28532853
}
28542854
it++;
28552855
}
@@ -3349,7 +3349,7 @@ bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState&
33493349
return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state));
33503350

33513351
if (!pindexPrev->IsValid(BLOCK_VALID_SCRIPTS)) {
3352-
for (const CBlockIndex* failedit : g_failed_blocks) {
3352+
for (const CBlockIndex* failedit : m_failed_blocks) {
33533353
if (pindexPrev->GetAncestor(failedit->nHeight) == failedit) {
33543354
assert(failedit->nStatus & BLOCK_FAILED_VALID);
33553355
CBlockIndex* invalid_walk = pindexPrev;
@@ -4218,7 +4218,7 @@ bool RewindBlockIndex(const CChainParams& params) {
42184218

42194219
void CChainState::UnloadBlockIndex() {
42204220
nBlockSequenceId = 1;
4221-
g_failed_blocks.clear();
4221+
m_failed_blocks.clear();
42224222
setBlockIndexCandidates.clear();
42234223
}
42244224

0 commit comments

Comments
 (0)