| 1325 | } |
| 1326 | |
| 1327 | void static InvalidChainFound(CBlockIndex* pindexNew) |
| 1328 | { |
| 1329 | if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork) |
| 1330 | pindexBestInvalid = pindexNew; |
| 1331 | |
| 1332 | // If the invalid chain found is supposed to be finalized, we need to move |
| 1333 | // back the finalization point. |
| 1334 | if (IsBlockFinalized(pindexNew)) { |
| 1335 | pindexFinalized = pindexNew->pprev; |
| 1336 | } |
| 1337 | |
| 1338 | LogPrintf("%s: invalid block=%s height=%d log2_work=%.8g date=%s\n", __func__, |
| 1339 | pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, |
| 1340 | log(pindexNew->nChainWork.getdouble())/log(2.0), FormatISO8601DateTime(pindexNew->GetBlockTime())); |
| 1341 | CBlockIndex *tip = chainActive.Tip(); |
| 1342 | assert (tip); |
| 1343 | LogPrintf("%s: current best=%s height=%d log2_work=%.8g date=%s\n", __func__, |
| 1344 | tip->GetBlockHash().ToString(), chainActive.Height(), log(tip->nChainWork.getdouble())/log(2.0), |
| 1345 | FormatISO8601DateTime(tip->GetBlockTime())); |
| 1346 | CheckForkWarningConditions(); |
| 1347 | } |
| 1348 | |
| 1349 | void CChainState::InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state) { |
| 1350 | if (!state.CorruptionPossible()) { |
no test coverage detected