AbstractChainDB.getStateDb() renamed to getTrieDB()

This commit is contained in:
Ștefan Talpalaru 2019-03-13 21:35:22 +01:00
parent 4ac8812707
commit 1481c824fa
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 3 additions and 3 deletions

View File

@ -347,7 +347,7 @@ method getBlockBody*(db: AbstractChainDB, blockHash: KeccakHash): BlockBodyRef {
method getReceipt*(db: AbstractChainDB, hash: KeccakHash): ReceiptRef {.base, gcsafe.} = method getReceipt*(db: AbstractChainDB, hash: KeccakHash): ReceiptRef {.base, gcsafe.} =
notImplemented() notImplemented()
method getStateDb*(db: AbstractChainDB): TrieDatabaseRef {.base, gcsafe.} = method getTrieDB*(db: AbstractChainDB): TrieDatabaseRef {.base, gcsafe.} =
notImplemented() notImplemented()
method getCodeByHash*(db: AbstractChainDB, hash: KeccakHash): Blob {.base, gcsafe.} = method getCodeByHash*(db: AbstractChainDB, hash: KeccakHash): Blob {.base, gcsafe.} =

View File

@ -15,11 +15,11 @@ proc getAccount*(db: TrieDatabaseRef,
proc getContractCode*(chain: AbstractChainDB, req: ContractCodeRequest): Blob {.gcsafe.} = proc getContractCode*(chain: AbstractChainDB, req: ContractCodeRequest): Blob {.gcsafe.} =
let b = chain.getBlockHeader(req.blockHash) let b = chain.getBlockHeader(req.blockHash)
if b.hasData: if b.hasData:
let acc = getAccount(chain.getStateDb, b.stateRoot, req.key) let acc = getAccount(chain.getTrieDB, b.stateRoot, req.key)
result = chain.getCodeByHash(acc.codeHash) result = chain.getCodeByHash(acc.codeHash)
proc getStorageNode*(chain: AbstractChainDB, hash: KeccakHash): Blob = proc getStorageNode*(chain: AbstractChainDB, hash: KeccakHash): Blob =
let db = chain.getStateDb let db = chain.getTrieDB
return db.get(hash.data) return db.get(hash.data)
# let trie = initSecureHexaryTrie(db, emptyRlpHash) # TODO emptyRlpHash is not correct here # let trie = initSecureHexaryTrie(db, emptyRlpHash) # TODO emptyRlpHash is not correct here
# return trie.get(unnecessary_OpenArrayToRange hash.data) # return trie.get(unnecessary_OpenArrayToRange hash.data)