aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:59:52 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:59:52 +0800
commitf486c0ae563eaf89a601ca5d60f30be96db2e69a (patch)
treea134ae6e38b90a268d91c61eab4ceb17856f2144 /trie
parentb5234413611ce5984292f85a01de1f56c045b490 (diff)
downloadgo-tangerine-f486c0ae563eaf89a601ca5d60f30be96db2e69a.tar.gz
go-tangerine-f486c0ae563eaf89a601ca5d60f30be96db2e69a.tar.zst
go-tangerine-f486c0ae563eaf89a601ca5d60f30be96db2e69a.zip
new type + additional methods
Diffstat (limited to 'trie')
-rw-r--r--trie/trie.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/trie/trie.go b/trie/trie.go
index 1c1112a7f..cb1e5618f 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -6,8 +6,8 @@ import (
"fmt"
"sync"
- "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/crypto"
)
func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) {
@@ -24,13 +24,13 @@ func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) {
type Trie struct {
mu sync.Mutex
root Node
- roothash []byte
+ roothash common.Hash
cache *Cache
revisions *list.List
}
-func New(root []byte, backend Backend) *Trie {
+func New(root common.Hash, backend Backend) *Trie {
trie := &Trie{}
trie.revisions = list.New()
trie.roothash = root
@@ -51,6 +51,9 @@ func (self *Trie) Iterator() *Iterator {
}
func (self *Trie) Copy() *Trie {
+ // cheap copying method
+ var cpy common.Hash
+ cpy.Set(self.roothash[:])
cpy := make([]byte, 32)
copy(cpy, self.roothash)
trie := New(nil, nil)