Skip to content

Commit 17f36ce

Browse files
author
ScottyPoi
committed
client: load history from era1 directory if option set
1 parent 0fb8322 commit 17f36ce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/client/bin/cli.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { Level } from 'level'
1111
import { EthereumClient } from '../src/client.js'
1212
import { DataDirectory } from '../src/config.js'
1313
import { LevelDB } from '../src/execution/level.js'
14+
import { eraSync } from '../src/sync/erasync.js'
15+
import { type ClientOpts } from '../src/types.js'
1416
import { generateVKTStateRoot } from '../src/util/vkt.js'
1517

1618
import { helpRPC, startRPCServers } from './startRPC.js'
@@ -19,7 +21,6 @@ import { generateClientConfig, getArgs } from './utils.js'
1921
import type { Config } from '../src/config.js'
2022
import type { Logger } from '../src/logging.js'
2123
import type { FullEthereumService } from '../src/service/index.js'
22-
import type { ClientOpts } from '../src/types.js'
2324
import type { RPCArgs } from './startRPC.js'
2425
import type { Block, BlockBytes } from '@ethereumjs/block'
2526
import type { ConsensusDict } from '@ethereumjs/blockchain'
@@ -220,7 +221,9 @@ async function startClient(
220221
...dbs,
221222
})
222223
await client.open()
223-
224+
if (args.loadBlocksFromEra1 !== undefined) {
225+
await eraSync(client, config, { loadBlocksFromEra1: args.loadBlocksFromEra1 })
226+
}
224227
if (args.loadBlocksFromRlp !== undefined) {
225228
// Specifically for Hive simulator, preload blocks provided in RLP format
226229
const blocks: Block[] = []

0 commit comments

Comments
 (0)