Skip to content

Commit

Permalink
♻️ Start updating baseState
Browse files Browse the repository at this point in the history
  • Loading branch information
roninjin10 committed Nov 3, 2024
1 parent b451111 commit 0147584
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/state/src/createBaseState.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export const createBaseState = (options) => {
}
const genesisPromise = (
options.genesisState !== undefined && options.currentStateRoot === undefined
? generateCanonicalGenesis(state)(options.genesisState)
? (generateCanonicalGenesis?.(state)?.(options.genesisState) ?? Promise.resolve())
: Promise.resolve().then(() => {
if (options.currentStateRoot) {
state.setCurrentStateRoot(options.currentStateRoot)
return generateCanonicalGenesis(state)(options.genesisState ?? stateRoots.get(options.currentStateRoot))
}
return Promise.resolve()
})
if (options.currentStateRoot) {
state.setCurrentStateRoot(options.currentStateRoot)
return generateCanonicalGenesis?.(state)?.(options.genesisState ?? stateRoots.get(options.currentStateRoot)) ?? Promise.resolve()
}
return Promise.resolve()
})
).then(async () => {
await checkpoint(state)()
await commit(state)()
Expand Down

0 comments on commit 0147584

Please sign in to comment.