It reads the Bitcoin Core LevelDB index (block/index) and uses the Blockstatus flag to determine if the block is valid and part of the active chain.
Currently using the following checks:
if ((BlockStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_CHAIN)
This seems to work for most blocks, but fails at block 0. 11.
As a result, the condition is evaluated error.
I think this is because block 0 is hardcoded and is probably handled differently by core.
So my question is:
- Is this a reasonable proxy that assumes that the block is fully validated based solely on LevelDB metadata? Or is this check essentially unreliable for that purpose?
- How does Bitcoin Core handle block status internally for block 0?
- You must skip block 0 and apply this check only to blocks
height > 0
?
Discover more from Earlybirds Invest
Subscribe to get the latest posts sent to your email.