Skip to content

Commit

Permalink
Wrap level in db interface
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed May 3, 2023
1 parent dcbf0c9 commit 3dfee9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/client/bin/cli.ts
Expand Up @@ -24,6 +24,7 @@ import * as readline from 'readline'

import { EthereumClient } from '../lib/client'
import { Config, DataDirectory, SyncMode } from '../lib/config'
import { LevelDB } from '../lib/execution/level'
import { getLogger } from '../lib/logging'
import { Event } from '../lib/types'
import { parseMultiaddrs } from '../lib/util'
Expand Down Expand Up @@ -424,7 +425,7 @@ async function startClient(config: Config, customGenesisState?: GenesisState) {
if (customGenesisState !== undefined) {
const validateConsensus = config.chainCommon.consensusAlgorithm() === ConsensusAlgorithm.Clique
blockchain = await Blockchain.create({
db: dbs.chainDB as any,
db: new LevelDB(dbs.chainDB),
genesisState: customGenesisState,
common: config.chainCommon,
hardforkByHeadBlockNumber: true,
Expand Down
5 changes: 3 additions & 2 deletions packages/client/lib/blockchain/chain.ts
Expand Up @@ -3,6 +3,7 @@ import { Blockchain } from '@ethereumjs/blockchain'
import { ConsensusAlgorithm, Hardfork } from '@ethereumjs/common'
import { equalsBytes } from 'ethereum-cryptography/utils'

import { LevelDB } from '../execution/level'
import { Event } from '../types'

import type { Config } from '../config'
Expand Down Expand Up @@ -133,7 +134,7 @@ export class Chain {
options.blockchain =
options.blockchain ??
new (Blockchain as any)({
db: options.chainDB,
db: new LevelDB(options.chainDB),
common: options.config.chainCommon,
hardforkByHeadBlockNumber: true,
validateBlocks: true,
Expand Down Expand Up @@ -213,7 +214,7 @@ export class Chain {
*/
async open(): Promise<boolean | void> {
if (this.opened) return false
await (this.blockchain.db as any)?.open()
await this.blockchain.db.open()
await (this.blockchain as any)._init()
this.opened = true
await this.update(false)
Expand Down

0 comments on commit 3dfee9b

Please sign in to comment.