Sitelet https://github.com/Fantom-foundation/go-opera/commit/51477d48fb045a72e36c3141732df37805a4051a
Skip to content

Commit 51477d4

Browse files
committed
use oprimized trie.StackTrie for Merkle root calculation
1 parent 5461d71 commit 51477d4

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎ethapi/api.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ func (s *PublicBlockChainAPI) calculateExtBlockApi(ctx context.Context, blkNumbe
708708
return ext
709709
}
710710
if receipts.Len() != 0 {
711-
ext.receiptsRoot = types.DeriveSha(receipts, new(trie.Trie))
711+
ext.receiptsRoot = types.DeriveSha(receipts, trie.NewStackTrie(nil))
712712
ext.bloom = types.CreateBloom(receipts)
713713
} else {
714714
ext.receiptsRoot = types.EmptyRootHash

‎evmcore/dummy_block.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func NewEvmBlock(h *EvmHeader, txs types.Transactions) *EvmBlock {
6363
if len(txs) == 0 {
6464
b.EvmHeader.TxHash = types.EmptyRootHash
6565
} else {
66-
b.EvmHeader.TxHash = types.DeriveSha(txs, new(trie.Trie))
66+
b.EvmHeader.TxHash = types.DeriveSha(txs, trie.NewStackTrie(nil))
6767
}
6868

6969
return b
@@ -152,7 +152,7 @@ func (b *EvmBlock) EthBlock() *types.Block {
152152
if b == nil {
153153
return nil
154154
}
155-
return types.NewBlock(b.EvmHeader.EthHeader(), b.Transactions, nil, nil, new(trie.Trie))
155+
return types.NewBlock(b.EvmHeader.EthHeader(), b.Transactions, nil, nil, trie.NewStackTrie(nil))
156156
}
157157

158158
func (b *EvmBlock) EstimateSize() int {

‎inter/event.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (e *payloadData) BlockVotes() LlrBlockVotes { return e.blockVotes }
204204
func (e *payloadData) EpochVote() LlrEpochVote { return e.epochVote }
205205

206206
func CalcTxHash(txs types.Transactions) hash.Hash {
207-
return hash.Hash(types.DeriveSha(txs, new(trie.Trie)))
207+
return hash.Hash(types.DeriveSha(txs, trie.NewStackTrie(nil)))
208208
}
209209

210210
func CalcReceiptsHash(receipts []*types.ReceiptForStorage) hash.Hash {

0 commit comments

Comments
 (0)