Commit b909a5ec authored by obscuren's avatar obscuren

Trie => SecureTrie

parent 1650b59c
...@@ -290,7 +290,7 @@ func (c *StateObject) Init() Code { ...@@ -290,7 +290,7 @@ func (c *StateObject) Init() Code {
return c.initCode return c.initCode
} }
func (self *StateObject) Trie() *trie.Trie { func (self *StateObject) Trie() *trie.SecureTrie {
return self.State.trie return self.State.trie
} }
......
...@@ -18,7 +18,7 @@ var statelogger = logger.NewLogger("STATE") ...@@ -18,7 +18,7 @@ var statelogger = logger.NewLogger("STATE")
// * Accounts // * Accounts
type StateDB struct { type StateDB struct {
db ethutil.Database db ethutil.Database
trie *trie.Trie trie *trie.SecureTrie
stateObjects map[string]*StateObject stateObjects map[string]*StateObject
...@@ -29,7 +29,7 @@ type StateDB struct { ...@@ -29,7 +29,7 @@ type StateDB struct {
// Create a new state from a given trie // Create a new state from a given trie
func New(root []byte, db ethutil.Database) *StateDB { func New(root []byte, db ethutil.Database) *StateDB {
trie := trie.New(ethutil.CopyBytes(root), db) trie := trie.NewSecure(ethutil.CopyBytes(root), db)
return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), refund: make(map[string]*big.Int)} return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), refund: make(map[string]*big.Int)}
} }
......
...@@ -30,3 +30,7 @@ func (self *SecureTrie) Delete(key []byte) Node { ...@@ -30,3 +30,7 @@ func (self *SecureTrie) Delete(key []byte) Node {
func (self *SecureTrie) DeleteString(key string) Node { func (self *SecureTrie) DeleteString(key string) Node {
return self.Delete([]byte(key)) return self.Delete([]byte(key))
} }
func (self *SecureTrie) Copy() *SecureTrie {
return &SecureTrie{self.Trie.Copy()}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment