diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-24 01:35:36 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-24 01:35:36 +0800 |
commit | 780abaec988df302e0c98f1a35e9af35b5623746 (patch) | |
tree | dfd26765ec08d3df756730bb186639edb388b4ee /core/types | |
parent | 1054c155db8ac59b97b81fa7a7a20f2239eb1e82 (diff) | |
download | dexon-780abaec988df302e0c98f1a35e9af35b5623746.tar dexon-780abaec988df302e0c98f1a35e9af35b5623746.tar.gz dexon-780abaec988df302e0c98f1a35e9af35b5623746.tar.bz2 dexon-780abaec988df302e0c98f1a35e9af35b5623746.tar.lz dexon-780abaec988df302e0c98f1a35e9af35b5623746.tar.xz dexon-780abaec988df302e0c98f1a35e9af35b5623746.tar.zst dexon-780abaec988df302e0c98f1a35e9af35b5623746.zip |
Switched to new trie
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/block.go | 4 | ||||
-rw-r--r-- | core/types/derive_sha.go | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/types/block.go b/core/types/block.go index 940f2402e..054767d67 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -9,9 +9,9 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/ptrie" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/trie" ) type Header struct { @@ -196,7 +196,7 @@ func (self *Block) Time() int64 { return int64(self.header.Time) } func (self *Block) GasLimit() *big.Int { return self.header.GasLimit } func (self *Block) GasUsed() *big.Int { return self.header.GasUsed } func (self *Block) Hash() []byte { return self.header.Hash() } -func (self *Block) Trie() *trie.Trie { return trie.New(ethutil.Config.Db, self.header.Root) } +func (self *Block) Trie() *ptrie.Trie { return ptrie.New(self.header.Root, ethutil.Config.Db) } func (self *Block) State() *state.StateDB { return state.New(self.Trie()) } func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(ethutil.Encode(self))) } diff --git a/core/types/derive_sha.go b/core/types/derive_sha.go index 1897ff198..0beb19670 100644 --- a/core/types/derive_sha.go +++ b/core/types/derive_sha.go @@ -2,7 +2,7 @@ package types import ( "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/ptrie" ) type DerivableList interface { @@ -11,10 +11,10 @@ type DerivableList interface { } func DeriveSha(list DerivableList) []byte { - trie := trie.New(ethutil.Config.Db, "") + trie := ptrie.New(nil, ethutil.Config.Db) for i := 0; i < list.Len(); i++ { - trie.Update(string(ethutil.NewValue(i).Encode()), string(list.GetRlp(i))) + trie.Update(ethutil.Encode(i), list.GetRlp(i)) } - return trie.GetRoot() + return trie.Root() } |