Updated block to use state instead of trie directly

This commit is contained in:
obscuren
2014-03-02 20:42:05 +01:00
parent f1b354e6aa
commit d65b4cd0dd
5 changed files with 60 additions and 45 deletions

View File

@ -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)
}