aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
commitb5234413611ce5984292f85a01de1f56c045b490 (patch)
treee6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /trie/trie.go
parent0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff)
downloaddexon-b5234413611ce5984292f85a01de1f56c045b490.tar.gz
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.zst
dexon-b5234413611ce5984292f85a01de1f56c045b490.zip
Moved ethutil => common
Diffstat (limited to 'trie/trie.go')
-rw-r--r--trie/trie.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/trie/trie.go b/trie/trie.go
index 9087f7bda..1c1112a7f 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -7,7 +7,7 @@ import (
"sync"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
)
func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) {
@@ -39,7 +39,7 @@ func New(root []byte, backend Backend) *Trie {
}
if root != nil {
- value := ethutil.NewValueFromBytes(trie.cache.Get(root))
+ value := common.NewValueFromBytes(trie.cache.Get(root))
trie.root = trie.mknode(value)
}
@@ -71,10 +71,10 @@ func (self *Trie) Hash() []byte {
if byts, ok := t.([]byte); ok && len(byts) > 0 {
hash = byts
} else {
- hash = crypto.Sha3(ethutil.Encode(self.root.RlpData()))
+ hash = crypto.Sha3(common.Encode(self.root.RlpData()))
}
} else {
- hash = crypto.Sha3(ethutil.Encode(""))
+ hash = crypto.Sha3(common.Encode(""))
}
if !bytes.Equal(hash, self.roothash) {
@@ -105,7 +105,7 @@ func (self *Trie) Reset() {
revision := self.revisions.Remove(self.revisions.Back()).([]byte)
self.roothash = revision
}
- value := ethutil.NewValueFromBytes(self.cache.Get(self.roothash))
+ value := common.NewValueFromBytes(self.cache.Get(self.roothash))
self.root = self.mknode(value)
}
@@ -294,7 +294,7 @@ func (self *Trie) delete(node Node, key []byte) Node {
}
// casting functions and cache storing
-func (self *Trie) mknode(value *ethutil.Value) Node {
+func (self *Trie) mknode(value *common.Value) Node {
l := value.Len()
switch l {
case 0:
@@ -320,7 +320,7 @@ func (self *Trie) mknode(value *ethutil.Value) Node {
func (self *Trie) trans(node Node) Node {
switch node := node.(type) {
case *HashNode:
- value := ethutil.NewValueFromBytes(self.cache.Get(node.key))
+ value := common.NewValueFromBytes(self.cache.Get(node.key))
return self.mknode(value)
default:
return node
@@ -328,7 +328,7 @@ func (self *Trie) trans(node Node) Node {
}
func (self *Trie) store(node Node) interface{} {
- data := ethutil.Encode(node)
+ data := common.Encode(node)
if len(data) >= 32 {
key := crypto.Sha3(data)
self.cache.Put(key, data)