resolve race condition in processBlock:
set the resolved fork id to the block.forkId field within the synchronized processBlock function to avoid a race condition with subsequent calls to processBlock that read the forkId of the previous block.
assign headBlock on fork creation
assign the current leaf block of a new fork as headBlock.
Otherwise new forks are being ignored by the canonical head computation until at least 1 blocks builds on top of it.
fix 2 issues with fork tracking:
processBlock
: set the resolved fork id to the block.forkId field within the synchronized processBlock function to avoid a race condition with subsequent calls to processBlock that read the forkId of the previous block.headBlock
on fork creation assign the current leaf block of a new fork asheadBlock
. Otherwise new forks are being ignored by the canonical head computation until at least 1 blocks builds on top of it.