We only need single "next state root hash" at any time for a BlockChain object and this does not need to be tracked in storage.
As for BlockChain.GetNextStateRootHash() method, there are numerous problems:
It isn't at all clear how the internal dictionary is managed. The result is too reliant code-paths that can be taken.
Having management of its state in the background only obfuscates it being rather ill-defined, which exacerbates the issue.
The method has a blocking implementation. This shouldn't be blocked from BlockChain's side, but rather the caller's side.
Shared storage between possible forks, although this may not be a non-issue in practice, adds unnecessary complexity.
We only need single "next state root hash" at any time for a
BlockChain
object and this does not need to be tracked in storage. As forBlockChain.GetNextStateRootHash()
method, there are numerous problems:BlockChain
's side, but rather the caller's side.