| 491 | } |
| 492 | |
| 493 | void BaseIndex::SetBestBlockIndex(const CBlockIndex* block) |
| 494 | { |
| 495 | assert(!m_chainstate->m_blockman.IsPruneMode() || AllowPrune()); |
| 496 | |
| 497 | if (AllowPrune() && block) { |
| 498 | node::PruneLockInfo prune_lock; |
| 499 | prune_lock.height_first = block->nHeight; |
| 500 | WITH_LOCK(::cs_main, m_chainstate->m_blockman.UpdatePruneLock(GetName(), prune_lock)); |
| 501 | } |
| 502 | |
| 503 | // Intentionally set m_best_block_index as the last step in this function, |
| 504 | // after updating prune locks above, and after making any other references |
| 505 | // to *this, so the BlockUntilSyncedToCurrentChain function (which checks |
| 506 | // m_best_block_index as an optimization) can be used to wait for the last |
| 507 | // BlockConnected notification and safely assume that prune locks are |
| 508 | // updated and that the index object is safe to delete. |
| 509 | m_best_block_index = block; |
| 510 | } |
nothing calls this directly
no test coverage detected