| 322 | } |
| 323 | |
| 324 | bool BaseIndex::BlockUntilSyncedToCurrentChain() const |
| 325 | { |
| 326 | AssertLockNotHeld(cs_main); |
| 327 | |
| 328 | if (!m_synced) { |
| 329 | return false; |
| 330 | } |
| 331 | |
| 332 | { |
| 333 | // Skip the queue-draining stuff if we know we're caught up with |
| 334 | // m_chain.Tip(). |
| 335 | LOCK(cs_main); |
| 336 | const CBlockIndex* chain_tip = m_chainstate->m_chain.Tip(); |
| 337 | const CBlockIndex* best_block_index = m_best_block_index.load(); |
| 338 | if (best_block_index->GetAncestor(chain_tip->nHeight) == chain_tip) { |
| 339 | return true; |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | LogPrintf("%s: %s is catching up on block notifications\n", __func__, GetName()); |
| 344 | SyncWithValidationInterfaceQueue(); |
| 345 | return true; |
| 346 | } |
| 347 | |
| 348 | void BaseIndex::Interrupt() |
| 349 | { |