I'm currently implementing the rpc call invalidateblock
on btcd, an alternate Bitcoin full node implementation. I'm trying to figure out how Bitcoin Core handles branch selection on reorganizations with invalidateblock
.
Say there's 3 chaintips like so:
genesis -> 1 -> 2 -> 3 (active) (chainwork=8)
\-> 1a (valid-fork) (chainwork=4)
\-> 1b (valid-fork) (chainwork=6)
Blocks at height 1 were received in the order of: 1, 1a, 1b
. Block 1
was received most recently and block 1b
was received last.
If I call invalidateblock
on block 2, which block will become the active chaintip?