aboutsummaryrefslogtreecommitdiffstats
path: root/state/statedb.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-02-11 18:40:12 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-02-11 18:40:12 +0800
commitcfddb7f3cd3b8cecb1e59412ce4db5769f6c8007 (patch)
treeab28c518bd1b78f6b8ac8b241951ad161cb268a9 /state/statedb.go
parent21fd31dad8bc6e0291ca405314b516670333c707 (diff)
parentc6af5f0a275608ea6c797ef826e6090885f24eac (diff)
downloadgo-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar
go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.gz
go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.bz2
go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.lz
go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.xz
go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.zst
go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.zip
Merge branch 'develop' into jsonrpc
Conflicts: rpc/ws/server.go
Diffstat (limited to 'state/statedb.go')
-rw-r--r--state/statedb.go19
1 files changed, 2 insertions, 17 deletions
diff --git a/state/statedb.go b/state/statedb.go
index 3176ab755..af054ff09 100644
--- a/state/statedb.go
+++ b/state/statedb.go
@@ -31,7 +31,7 @@ type StateDB struct {
// Create a new state from a given trie
func New(root []byte, db ethutil.Database) *StateDB {
- trie := trie.New(root, db)
+ trie := trie.New(ethutil.CopyBytes(root), db)
return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)}
}
@@ -234,12 +234,9 @@ func (self *StateDB) Copy() *StateDB {
}
func (self *StateDB) Set(state *StateDB) {
- if state == nil {
- panic("Tried setting 'state' to nil through 'Set'")
- }
-
self.trie = state.trie
self.stateObjects = state.stateObjects
+
self.refund = state.refund
self.logs = state.logs
}
@@ -290,30 +287,18 @@ func (self *StateDB) Refunds() map[string]*big.Int {
}
func (self *StateDB) Update(gasUsed *big.Int) {
- var deleted bool
self.refund = make(map[string]*big.Int)
for _, stateObject := range self.stateObjects {
if stateObject.remove {
self.DeleteStateObject(stateObject)
- deleted = true
} else {
stateObject.Sync()
self.UpdateStateObject(stateObject)
}
}
-
- // FIXME trie delete is broken
- if deleted {
- valid, t2 := trie.ParanoiaCheck(self.trie, self.db)
- if !valid {
- statelogger.Infof("Warn: PARANOIA: Different state root during copy %x vs %x\n", self.trie.Root(), t2.Root())
-
- self.trie = t2
- }
- }
}
func (self *StateDB) Manifest() *Manifest {