@typeberry/jam 0.3.0 → 0.3.1-27dfdd9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24937,13 +24937,6 @@ class Importer {
24937
24937
  logger.error `🧱 Unable to update state: ${resultToString(updateResult)}`;
24938
24938
  return importerError(ImporterErrorKind.Update, updateResult);
24939
24939
  }
24940
- const newState = this.states.getState(headerHash);
24941
- if (newState === null) {
24942
- throw new Error("Freshly updated state not in the DB?");
24943
- }
24944
- // TODO [ToDr] This is a temporary measure. We should rather read
24945
- // the state of a parent block to support forks and create a fresh STF.
24946
- this.state.updateBackend(newState.backend);
24947
24940
  this.prepareForNextEpoch();
24948
24941
  this.currentHash = headerHash;
24949
24942
  logger.log `${timerState()}`;
@@ -24952,7 +24945,7 @@ class Importer {
24952
24945
  const writeBlocks = this.blocks.insertBlock(new WithHash(headerHash, block));
24953
24946
  // Computation of the state root may happen asynchronously,
24954
24947
  // but we still need to wait for it before next block can be imported
24955
- const stateRoot = await this.states.getStateRoot(newState);
24948
+ const stateRoot = await this.states.getStateRoot(this.state);
24956
24949
  logger.log `🧱 Storing post-state-root for ${headerHash}: ${stateRoot}.`;
24957
24950
  const writeStateRoot = this.blocks.setPostStateRoot(headerHash, stateRoot);
24958
24951
  await Promise.all([writeBlocks, writeStateRoot]);