Chain state improperly promoted in case of reorg.
Closed this issue · 2 comments
evoskuil commented
The change state caching optimization promotes the pool state to next block state in the case where the next block is not a reorg. However reorg was computed based on a mismatch between branch top height and pool height. This is incorrect in the case where the reorg branch reaches the same height as the pool.
Instead the branch must first be tested for single block size, in which case the height match is correct.
evoskuil commented
An additional related issue was discovered in that the post-reorg setting of the pool chain state is based on the front block in the reorg, vs. the back block. This results in an incorrect pool chain state following the reorg if there was more than one block in the reorg.