Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
setBlockIndexCandidates
can become empty if the chain tip is not included in the set, which violates an internal invariant and leads to a crash during FindMostWorkChain()
. This issue and potential solutions were originally surfaced by ataraxia009 in #33127.
Expected behaviour
After pruning, the active tip must be present in the candidate set. No crash should occur in FindMostWorkChain()
.
Steps to reproduce
Mine a chain
Manually remove the tip from setBlockIndexCandidates
Call PruneBlockIndexCandidates()
Observe that setBlockIndexCandidates
no longer contains the tip -> This violates an invariant relied upon by FindMostWorkChain()
Relevant log output
No response
How did you obtain Bitcoin Core
Compiled from source
What version of Bitcoin Core are you using?
v29.99.0-75ed673
Operating system and version
Mac
Machine specifications
No response