aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/state.go')
-rw-r--r--ethchain/state.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/ethchain/state.go b/ethchain/state.go
index 6ec6916f4..e209e0e2f 100644
--- a/ethchain/state.go
+++ b/ethchain/state.go
@@ -99,7 +99,21 @@ func (s *State) Cmp(other *State) bool {
}
func (s *State) Copy() *State {
- return NewState(s.trie.Copy())
+ state := NewState(s.trie.Copy())
+ for k, subState := range s.states {
+ state.states[k] = subState.Copy()
+ }
+
+ return state
+}
+
+func (s *State) Snapshot() *State {
+ return s.Copy()
+}
+
+func (s *State) Revert(snapshot *State) {
+ s.trie = snapshot.trie
+ s.states = snapshot.states
}
func (s *State) Put(key, object []byte) {