Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,672 Lines • ▼ Show 20 Lines | bool CChainState::ConnectBlock(const Config &config, const CBlock &block, | ||||
// for one general approach that was used for BIP 141 deployment). | // for one general approach that was used for BIP 141 deployment). | ||||
// Also, currently the rule against blocks more than 2 hours in the future | // Also, currently the rule against blocks more than 2 hours in the future | ||||
// is enforced in ContextualCheckBlockHeader(); we wouldn't want to | // is enforced in ContextualCheckBlockHeader(); we wouldn't want to | ||||
// re-enforce that rule here (at least until we make it impossible for | // re-enforce that rule here (at least until we make it impossible for | ||||
// GetAdjustedTime() to go backward). | // GetAdjustedTime() to go backward). | ||||
BlockValidationOptions validationOptions = | BlockValidationOptions validationOptions = | ||||
BlockValidationOptions(!fJustCheck, !fJustCheck); | BlockValidationOptions(!fJustCheck, !fJustCheck); | ||||
if (!CheckBlock(config, block, state, validationOptions)) { | if (!CheckBlock(config, block, state, validationOptions)) { | ||||
if (state.CorruptionPossible()) { | |||||
// We don't write down blocks to disk if they may have been | |||||
// corrupted, so this should be impossible unless we're having | |||||
// hardware problems. | |||||
return AbortNode(state, "Corrupt block found indicating potential " | |||||
"hardware failure; shutting down"); | |||||
} | |||||
return error("%s: Consensus::CheckBlock: %s", __func__, | return error("%s: Consensus::CheckBlock: %s", __func__, | ||||
FormatStateMessage(state)); | FormatStateMessage(state)); | ||||
} | } | ||||
// Verify that the view's current state corresponds to the previous block | // Verify that the view's current state corresponds to the previous block | ||||
uint256 hashPrevBlock = | uint256 hashPrevBlock = | ||||
pindex->pprev == nullptr ? uint256() : pindex->pprev->GetBlockHash(); | pindex->pprev == nullptr ? uint256() : pindex->pprev->GetBlockHash(); | ||||
assert(hashPrevBlock == view.GetBestBlock()); | assert(hashPrevBlock == view.GetBestBlock()); | ||||
▲ Show 20 Lines • Show All 3,973 Lines • Show Last 20 Lines |