MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ResetBlockFailureFlags

Method ResetBlockFailureFlags

src/validation.cpp:3721–3740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3719}
3720
3721void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
3722 AssertLockHeld(cs_main);
3723
3724 int nHeight = pindex->nHeight;
3725
3726 // Remove the invalidity flag from this block and all its descendants and ancestors.
3727 for (auto& [_, block_index] : m_blockman.m_block_index) {
3728 if ((block_index.nStatus & BLOCK_FAILED_VALID) && (block_index.GetAncestor(nHeight) == pindex || pindex->GetAncestor(block_index.nHeight) == &block_index)) {
3729 block_index.nStatus &= ~BLOCK_FAILED_VALID;
3730 m_blockman.m_dirty_blockindex.insert(&block_index);
3731 if (block_index.IsValid(BLOCK_VALID_TRANSACTIONS) && block_index.HaveNumChainTxs() && setBlockIndexCandidates.value_comp()(m_chain.Tip(), &block_index)) {
3732 setBlockIndexCandidates.insert(&block_index);
3733 }
3734 if (&block_index == m_chainman.m_best_invalid) {
3735 // Reset invalid block marker if it was pointing to one of those.
3736 m_chainman.m_best_invalid = nullptr;
3737 }
3738 }
3739 }
3740}
3741
3742void Chainstate::TryAddBlockIndexCandidate(CBlockIndex* pindex)
3743{

Callers 2

BOOST_FIXTURE_TEST_CASEFunction · 0.80
ReconsiderBlockFunction · 0.80

Calls 5

HaveNumChainTxsMethod · 0.80
GetAncestorMethod · 0.45
insertMethod · 0.45
IsValidMethod · 0.45
TipMethod · 0.45

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.64