Called both upon regular invalid block discovery *and* InvalidateBlock
| 1968 | |
| 1969 | // Called both upon regular invalid block discovery *and* InvalidateBlock |
| 1970 | void Chainstate::InvalidChainFound(CBlockIndex* pindexNew) |
| 1971 | { |
| 1972 | AssertLockHeld(cs_main); |
| 1973 | if (!m_chainman.m_best_invalid || pindexNew->nChainWork > m_chainman.m_best_invalid->nChainWork) { |
| 1974 | m_chainman.m_best_invalid = pindexNew; |
| 1975 | } |
| 1976 | SetBlockFailureFlags(pindexNew); |
| 1977 | if (m_chainman.m_best_header != nullptr && m_chainman.m_best_header->GetAncestor(pindexNew->nHeight) == pindexNew) { |
| 1978 | m_chainman.RecalculateBestHeader(); |
| 1979 | } |
| 1980 | |
| 1981 | LogInfo("%s: invalid block=%s height=%d log2_work=%f date=%s", __func__, |
| 1982 | pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, |
| 1983 | log(pindexNew->nChainWork.getdouble())/log(2.0), FormatISO8601DateTime(pindexNew->GetBlockTime())); |
| 1984 | CBlockIndex *tip = m_chain.Tip(); |
| 1985 | assert (tip); |
| 1986 | LogInfo("%s: current best=%s height=%d log2_work=%f date=%s", __func__, |
| 1987 | tip->GetBlockHash().ToString(), m_chain.Height(), log(tip->nChainWork.getdouble())/log(2.0), |
| 1988 | FormatISO8601DateTime(tip->GetBlockTime())); |
| 1989 | CheckForkWarningConditions(); |
| 1990 | } |
| 1991 | |
| 1992 | // Same as InvalidChainFound, above, except not called directly from InvalidateBlock, |
| 1993 | // which does its own setBlockIndexCandidates management. |
nothing calls this directly
no test coverage detected