From 09d44e9925a5a3f983ae1861f7ecdf69f49ab888 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 16 Apr 2021 14:58:23 +0200 Subject: [PATCH] core/state/snapshot: avoid copybytes for stacktrie --- core/state/snapshot/generate.go | 2 +- trie/trie_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/state/snapshot/generate.go b/core/state/snapshot/generate.go index 98c8d42a1a..ed431fcb3d 100644 --- a/core/state/snapshot/generate.go +++ b/core/state/snapshot/generate.go @@ -317,7 +317,7 @@ func (dl *diskLayer) proveRange(stats *generatorStats, root common.Hash, prefix if origin == nil && !diskMore { stackTr := trie.NewStackTrie(nil) for i, key := range keys { - stackTr.TryUpdate(key, common.CopyBytes(vals[i])) + stackTr.TryUpdate(key, vals[i]) } if gotRoot := stackTr.Hash(); gotRoot != root { return &proofResult{ diff --git a/trie/trie_test.go b/trie/trie_test.go index d6930fdee7..492b423c2f 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -830,8 +830,8 @@ func TestCommitSequenceStackTrie(t *testing.T) { val = make([]byte, 1+prng.Intn(1024)) } prng.Read(val) - trie.TryUpdate(key, common.CopyBytes(val)) - stTrie.TryUpdate(key, common.CopyBytes(val)) + trie.TryUpdate(key, val) + stTrie.TryUpdate(key, val) } // Flush trie -> database root, _ := trie.Commit(nil)