Closes #30878
It seems like there is a race where the block is stored locally and getblock
does not error anymore, but ActivateBestChain
has not finished yet, so the local services are not updated yet either. Fix this by waiting for the local services to update.
Can be reproduced locally by adding the sleep here:
0──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
1src/validation.cpp:3567: bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< │
2──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
3 }
4
5 if (WITH_LOCK(::cs_main, return m_disabled)) {
6 std::this_thread::sleep_for(std::chrono::seconds(10));
7 // Background chainstate has reached the snapshot base block, so exit.
8
9 // Restart indexes to resume indexing for all blocks unique to the snapshot