Closed leo-bogastry closed 3 years ago
I don't disagree with this change but I feel the main improvement it does is mention the TODO in the code that this logic needs to move to a blockchain-storage related component. It won't affect the actual bug because that doesn't have much to do with fast sync, as discussed.
I think you are probably right. The modification shows that is was not just about having cache and storage in synchronization, different storages should also be always syncronized
Description
Calling
appStateStorage.putBestBlockNumber
that makes an update to the best block number without callingblockNumberMappingStorage.put
to add the mapping between the block number and block hash can result on aNone
when callingblockchain.getBestBlock
. I wanted to add these two calls together in the blockchain or blockchainwriter class, but it is not that straight forward.In order to be able to test this modification already I applied the fix in FastSync and created ETCM-1089 for a proper refactor
Testing
This has been tested against mainnet.