cleanup: replace unnecessary initHexaryTrie with emptyRlpHash

it's simple non-sense
This commit is contained in:
jangko 2021-10-28 10:48:28 +07:00
parent e1abf81cac
commit f0a0c1b878
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9

View File

@ -1,16 +1,14 @@
import import
std/tables, std/tables,
eth/[common, rlp, trie, p2p], eth/[common, rlp, trie, p2p],
chronicles, eth/trie/db, chronicles, eth/trie/[db, trie_defs],
./db/[db_chain, state_db], ./db/[db_chain, state_db],
./constants, "."/[constants, chain_config, forks, p2p/gaslimit]
./chain_config, ./forks, ./p2p/gaslimit
proc toBlock*(g: Genesis, db: BaseChainDB = nil): BlockHeader = proc toBlock*(g: Genesis, db: BaseChainDB = nil): BlockHeader =
let (tdb, pruneTrie) = if db.isNil: (newMemoryDB(), true) let (tdb, pruneTrie) = if db.isNil: (newMemoryDB(), true)
else: (db.db, db.pruneTrie) else: (db.db, db.pruneTrie)
var trie = initHexaryTrie(tdb) var sdb = newAccountStateDB(tdb, emptyRlpHash, pruneTrie)
var sdb = newAccountStateDB(tdb, trie.rootHash, pruneTrie)
for address, account in g.alloc: for address, account in g.alloc:
sdb.setAccount(address, newAccount(account.nonce, account.balance)) sdb.setAccount(address, newAccount(account.nonce, account.balance))