MCPcopy Create free account
hub / github.com/ElementsProject/elements / ResetBlockFailureFlags

Method ResetBlockFailureFlags

src/validation.cpp:3481–3513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3479}
3480
3481void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
3482 AssertLockHeld(cs_main);
3483
3484 int nHeight = pindex->nHeight;
3485
3486 // Remove the invalidity flag from this block and all its descendants.
3487 BlockMap::iterator it = m_blockman.m_block_index.begin();
3488 while (it != m_blockman.m_block_index.end()) {
3489 if (!it->second->IsValid() && it->second->GetAncestor(nHeight) == pindex) {
3490 it->second->nStatus &= ~BLOCK_FAILED_MASK;
3491 m_blockman.m_dirty_blockindex.insert(it->second);
3492 if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->HaveTxsDownloaded() && setBlockIndexCandidates.value_comp()(m_chain.Tip(), it->second)) {
3493 setBlockIndexCandidates.insert(it->second);
3494 }
3495 if (it->second == m_chainman.m_best_invalid) {
3496 // Reset invalid block marker if it was pointing to one of those.
3497 m_chainman.m_best_invalid = nullptr;
3498 }
3499 m_chainman.m_failed_blocks.erase(it->second);
3500 }
3501 it++;
3502 }
3503
3504 // Remove the invalidity flag from all ancestors too.
3505 while (pindex != nullptr) {
3506 if (pindex->nStatus & BLOCK_FAILED_MASK) {
3507 pindex->nStatus &= ~BLOCK_FAILED_MASK;
3508 m_blockman.m_dirty_blockindex.insert(pindex);
3509 m_chainman.m_failed_blocks.erase(pindex);
3510 }
3511 pindex = pindex->pprev;
3512 }
3513}
3514
3515/** Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */
3516void CChainState::ReceivedBlockTransactions(const CBlock& block, CBlockIndex* pindexNew, const FlatFilePos& pos)

Callers 1

reconsiderblockFunction · 0.80

Calls 8

GetAncestorMethod · 0.80
HaveTxsDownloadedMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
IsValidMethod · 0.45
insertMethod · 0.45
TipMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected