-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix reorg handling #5819
Fix reorg handling #5819
Conversation
and FullNode The custom implementations triggered to repeat requests but we shut down the seed node in case of a reorg and for desktops we request the user to shutdown.
…tion We trigger a resync from resources if there is a reorg and don't want to continue to request blocks
persistance is below the chain height of btc core. With the new handling of dao state hashblocks it can be the we have persisted the latest block up to the chain height. Before that change we only had the last snapshot which was at least 20 blocks back persisted. We want to avoid to get caught in a retry loop at parseBlocksOnHeadHeight so we filter out that case just at the caller. At parseBlocksOnHeadHeight we inline the requestChainHeadHeightAndParseBlocks method as it is not used by other callers anymore. This case that we request a block but our local btc core chain hight is below that might be some edge case when we had a synced dao blocks but we btc core is resyncing...
We shut down with a deterministic delay per seed to avoid that all seeds shut down at the same time in case of a reorg. We use 30 sec. as distance delay between the seeds to be on the safe side. We have 12 seeds so that's 6 minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK - Tested the process on Regtest and was able to simulate the behavior as described.
- Seednode shut down
- Full node got notified to shut down
- Light node didn't recognize the reorg yet
- Seednode and Alice (fullnode) were restarted
- After creating new blocks, Bob (light node) recognized the reorg
After restart of Light node everything went back to normal.
Fixes #5809
How to reproduce:
In master the Alice nad Bob nodes get caught in an endless loop requesting new blocks. The seed node is shut down automatically. Bob will start the endless loop only after the seed has restarted and the next block is propagated.
With the PR version there is just the shutdown at seed node and the shutdown popup at desktop apps but no loops.
The litenode will not recognize the new block as the full nodes are shut down or inactive. Only after restarting the seed and creating a new block the lite node will detect the reorg. The block propagation is delayed with a random delay so it can take a bit...
To avoid that all seed nodes shut down at the same time when a reorg happens we add a detereministic delay derived from the index of the seed in the seed node list. So shut down is delayed by 30 sec * index, distributing the shutdown of 12 seeds over 6 minutes.