| 428 | } |
| 429 | |
| 430 | bool BaseIndex::BlockUntilSyncedToCurrentChain() const |
| 431 | { |
| 432 | AssertLockNotHeld(cs_main); |
| 433 | |
| 434 | if (!m_synced) { |
| 435 | return false; |
| 436 | } |
| 437 | |
| 438 | { |
| 439 | // Skip the queue-draining stuff if we know we're caught up with |
| 440 | // m_chain.Tip(). |
| 441 | LOCK(cs_main); |
| 442 | const CBlockIndex* chain_tip = m_chainstate->m_chain.Tip(); |
| 443 | const CBlockIndex* best_block_index = m_best_block_index.load(); |
| 444 | if (best_block_index->GetAncestor(chain_tip->nHeight) == chain_tip) { |
| 445 | return true; |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | LogInfo("%s is catching up on block notifications", GetName()); |
| 450 | m_chain->context()->validation_signals->SyncWithValidationInterfaceQueue(); |
| 451 | return true; |
| 452 | } |
| 453 | |
| 454 | void BaseIndex::Interrupt() |
| 455 | { |