aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/derive_sha.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/types/derive_sha.go')
-rw-r--r--core/types/derive_sha.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/types/derive_sha.go b/core/types/derive_sha.go
index 0fc45a508..10e3d7446 100644
--- a/core/types/derive_sha.go
+++ b/core/types/derive_sha.go
@@ -3,6 +3,7 @@ package types
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
+ "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
)
@@ -15,7 +16,8 @@ func DeriveSha(list DerivableList) common.Hash {
db, _ := ethdb.NewMemDatabase()
trie := trie.New(nil, db)
for i := 0; i < list.Len(); i++ {
- trie.Update(common.Encode(i), list.GetRlp(i))
+ key, _ := rlp.EncodeToBytes(i)
+ trie.Update(key, list.GetRlp(i))
}
return common.BytesToHash(trie.Root())