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

Function ConnectBlockOnFinChain

src/main.cpp:1487–1504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1485}
1486
1487bool ConnectBlockOnFinChain(CBlockIndex* pNewIndex, CValidationState& state) {
1488 if (pNewIndex && (chainActive.Tip() == pNewIndex->pprev)) {
1489 if (!ConnectTip(state, pNewIndex)) {
1490 if (state.IsInvalid()) {
1491 if (!state.CorruptionPossible()) // The block violates a consensus rule.
1492 InvalidChainFound(pNewIndex);
1493
1494 } else {
1495 // A system error occurred (disk space, database error, ...).
1496 return false;
1497 }
1498 }
1499
1500 mempool.ReScanMemPoolTx();
1501 }
1502 return true;
1503
1504}
1505// Try to activate to the most-work chain (thereby connecting it).
1506bool ActivateBestChain(CValidationState &state, CBlockIndex* pNewIndex) {
1507 LOCK(cs_main);

Callers 1

ActivateBestChainFunction · 0.85

Calls 6

ConnectTipFunction · 0.85
InvalidChainFoundFunction · 0.85
TipMethod · 0.80
IsInvalidMethod · 0.80
CorruptionPossibleMethod · 0.80
ReScanMemPoolTxMethod · 0.80

Tested by

no test coverage detected