|
|
@ -646,14 +646,18 @@ export class Blockchain extends Plugin { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async loadContext(context: string) { |
|
|
|
async loadContext(context: string) { |
|
|
|
const contextExists = await this.call('fileManager', 'exists', `.states/${context}/state.json`) |
|
|
|
const saveEvmState = this.config.get('settings/save-env-state') |
|
|
|
|
|
|
|
|
|
|
|
if (contextExists) { |
|
|
|
if (saveEvmState) { |
|
|
|
const stateDb = await this.call('fileManager', 'readFile', `.states/${context}/state.json`) |
|
|
|
const contextExists = await this.call('fileManager', 'exists', `.states/${context}/state.json`) |
|
|
|
|
|
|
|
|
|
|
|
await this.getCurrentProvider().resetEnvironment(stateDb) |
|
|
|
if (contextExists) { |
|
|
|
} else { |
|
|
|
const stateDb = await this.call('fileManager', 'readFile', `.states/${context}/state.json`) |
|
|
|
await this.getCurrentProvider().resetEnvironment() |
|
|
|
|
|
|
|
|
|
|
|
await this.getCurrentProvider().resetEnvironment(stateDb) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await this.getCurrentProvider().resetEnvironment() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: most params here can be refactored away in txRunner
|
|
|
|
// TODO: most params here can be refactored away in txRunner
|
|
|
|