aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-03 03:42:05 +0800
committerobscuren <geffobscura@gmail.com>2014-03-03 03:42:05 +0800
commitd65b4cd0dd49975410374801fae3ece7d7e087b3 (patch)
treef8ce81fc3c9f376d65db151f4856118fdba13828 /ethchain/state.go
parentf1b354e6aa6c4b0330e35ae9011784ff1a0b01ab (diff)
downloadgo-tangerine-d65b4cd0dd49975410374801fae3ece7d7e087b3.tar.gz
go-tangerine-d65b4cd0dd49975410374801fae3ece7d7e087b3.tar.zst
go-tangerine-d65b4cd0dd49975410374801fae3ece7d7e087b3.zip
Updated block to use state instead of trie directly
Diffstat (limited to 'ethchain/state.go')
-rw-r--r--ethchain/state.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/ethchain/state.go b/ethchain/state.go
index 1a18ea1d7..cff192b54 100644
--- a/ethchain/state.go
+++ b/ethchain/state.go
@@ -13,6 +13,10 @@ func NewState(trie *ethutil.Trie) *State {
return &State{trie: trie}
}
+func (s *State) Reset() {
+ s.trie.Undo()
+}
+
func (s *State) GetContract(addr []byte) *Contract {
data := s.trie.Get(string(addr))
if data == "" {
@@ -54,3 +58,7 @@ func (s *State) GetAccount(addr []byte) (account *Address) {
func (s *State) UpdateAccount(addr []byte, account *Address) {
s.trie.Update(string(addr), string(account.RlpEncode()))
}
+
+func (s *State) Cmp(other *State) bool {
+ return s.trie.Cmp(other.trie)
+}