Skip to content

Commit

Permalink
Trie => SecureTrie
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Mar 3, 2015
1 parent 1650b59 commit b909a5e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (c *StateObject) Init() Code {
return c.initCode
}

func (self *StateObject) Trie() *trie.Trie {
func (self *StateObject) Trie() *trie.SecureTrie {
return self.State.trie
}

Expand Down
4 changes: 2 additions & 2 deletions state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var statelogger = logger.NewLogger("STATE")
// * Accounts
type StateDB struct {
db ethutil.Database
trie *trie.Trie
trie *trie.SecureTrie

stateObjects map[string]*StateObject

Expand All @@ -29,7 +29,7 @@ type StateDB struct {

// Create a new state from a given trie
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)}
}

Expand Down
4 changes: 4 additions & 0 deletions trie/secure_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ func (self *SecureTrie) Delete(key []byte) Node {
func (self *SecureTrie) DeleteString(key string) Node {
return self.Delete([]byte(key))
}

func (self *SecureTrie) Copy() *SecureTrie {
return &SecureTrie{self.Trie.Copy()}
}

0 comments on commit b909a5e

Please sign in to comment.