MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / InvalidateBlock

Function InvalidateBlock

src/main.cpp:555–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555bool InvalidateBlock(CValidationState &state, CBlockIndex *pIndex) {
556 AssertLockHeld(cs_main);
557
558 // Mark the block itself as invalid.
559 if (!InvalidateBlockIndex(pIndex)) {
560 return ERRORMSG("invalidate block=%s index failed", pIndex->GetIdString());
561 }
562
563 while (chainActive.Contains(pIndex)) {
564 if (!InvalidateBlockIndex(chainActive.Tip())) {
565 return ERRORMSG("invalidate block=%s index failed", pIndex->GetIdString());
566 }
567 // ActivateBestChain considers blocks already in chainActive
568 // unconditionally valid already, so force disconnect away from it.
569 if (!DisconnectTip(state)) {
570 return false;
571 }
572 }
573
574 InvalidChainFound(pIndex);
575 return true;
576}
577
578
579bool ReconsiderBlockIndex(CBlockIndex *pIndex) {

Callers 1

invalidateblockFunction · 0.85

Calls 6

InvalidateBlockIndexFunction · 0.85
DisconnectTipFunction · 0.85
InvalidChainFoundFunction · 0.85
GetIdStringMethod · 0.80
TipMethod · 0.80
ContainsMethod · 0.45

Tested by

no test coverage detected