Skip to content

Commit

Permalink
improve resume (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii authored Oct 17, 2023
1 parent 732150c commit da7db27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/chopsticks/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import './utils/tunnel'
import { BlockEntity } from '@acala-network/chopsticks-core/db/entities'
import { Config } from './schema'
import { HexString } from '@polkadot/util/types'
import { defaultLogger, setup, timeTravel } from '@acala-network/chopsticks-core'
import { overrideStorage, overrideWasm } from './utils/override'
import { setup, timeTravel } from '@acala-network/chopsticks-core'

const logger = defaultLogger.child({ name: 'setup-context' })

export const setupContext = async (argv: Config, overrideParent = false) => {
const chain = await setup({
Expand Down Expand Up @@ -38,6 +40,9 @@ export const setupContext = async (argv: Config, overrideParent = false) => {
if (blockData) {
const block = await chain.loadBlockFromDB(blockData?.number)
block && (await chain.setHead(block))
logger.info(`Resume from block ${blockData.number}, hash: ${blockData.hash}`)
} else {
throw new Error(`Resume failed. Cannot find block ${argv.resume}`)
}
}
}
Expand Down

0 comments on commit da7db27

Please sign in to comment.