mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-24 11:11:59 +00:00
fixes getReceipts proc signature in db_chain.nim
instead of using header as input param, now getReceipts using receiptRoot hash, the intention is clearer and less data passed around when we only using receiptRoot instead of whole block header.
This commit is contained in:
parent
1728dd8d54
commit
82d4f6a2d4
@ -278,8 +278,8 @@ proc persistReceipts*(self: BaseChainDB, receipts: openArray[Receipt]): Hash256
|
||||
trie.put(rlp.encode(idx), rlp.encode(rec))
|
||||
trie.rootHash
|
||||
|
||||
iterator getReceipts*(self: BaseChainDB; header: BlockHeader): Receipt =
|
||||
var receiptDb = initHexaryTrie(self.db, header.receiptRoot)
|
||||
iterator getReceipts*(self: BaseChainDB; receiptRoot: Hash256): Receipt =
|
||||
var receiptDb = initHexaryTrie(self.db, receiptRoot)
|
||||
var receiptIdx = 0
|
||||
while true:
|
||||
let receiptKey = rlp.encode(receiptIdx)
|
||||
|
@ -365,7 +365,7 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB , server: RpcServer) =
|
||||
idx = 0
|
||||
prevGasUsed = GasInt(0)
|
||||
|
||||
for receipt in chain.getReceipts(header):
|
||||
for receipt in chain.getReceipts(header.receiptRoot):
|
||||
let gasUsed = receipt.cumulativeGasUsed - prevGasUsed
|
||||
prevGasUsed = receipt.cumulativeGasUsed
|
||||
if idx == txDetails.index:
|
||||
|
@ -32,7 +32,7 @@ proc toJson(receipt: Receipt): JsonNode =
|
||||
|
||||
proc dumpReceipts*(chainDB: BaseChainDB, header: BlockHeader): JsonNode =
|
||||
result = newJArray()
|
||||
for receipt in chainDB.getReceipts(header):
|
||||
for receipt in chainDB.getReceipts(header.receiptRoot):
|
||||
result.add receipt.toJson
|
||||
|
||||
proc toJson*(receipts: seq[Receipt]): JsonNode =
|
||||
|
Loading…
x
Reference in New Issue
Block a user