diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-06-24 01:19:33 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-06-24 01:19:33 +0800 |
commit | 72e2613a9fe3205fa5a67b72b832e03b2357ee88 (patch) | |
tree | bbc987510d279d9e174ff8f684158d668131661e /core/state/state_test.go | |
parent | 5daf8729be88eca87b302ebf7a46fc69cad0f6d0 (diff) | |
parent | 67e6f74e9af00ff011a6a02f18644804eb18cdaa (diff) | |
download | go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.gz go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.bz2 go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.lz go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.xz go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.zst go-tangerine-72e2613a9fe3205fa5a67b72b832e03b2357ee88.zip |
Merge branch 'release/0.9.32'v0.9.32
Diffstat (limited to 'core/state/state_test.go')
-rw-r--r-- | core/state/state_test.go | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/core/state/state_test.go b/core/state/state_test.go index 09a65de54..00e133dab 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -70,37 +70,34 @@ func TestNull(t *testing.T) { address := common.HexToAddress("0x823140710bf13990e4500136726d8b55") state.CreateAccount(address) //value := common.FromHex("0x823140710bf13990e4500136726d8b55") - value := make([]byte, 16) + var value common.Hash state.SetState(address, common.Hash{}, value) state.Update() state.Sync() value = state.GetState(address, common.Hash{}) + if !common.EmptyHash(value) { + t.Errorf("expected empty hash. got %x", value) + } } func (s *StateSuite) TestSnapshot(c *checker.C) { stateobjaddr := toAddr([]byte("aa")) - storageaddr := common.Big("0") - data1 := common.NewValue(42) - data2 := common.NewValue(43) + var storageaddr common.Hash + data1 := common.BytesToHash([]byte{42}) + data2 := common.BytesToHash([]byte{43}) - // get state object - stateObject := s.state.GetOrNewStateObject(stateobjaddr) // set inital state object value - stateObject.SetStorage(storageaddr, data1) + s.state.SetState(stateobjaddr, storageaddr, data1) // get snapshot of current state snapshot := s.state.Copy() - // get state object. is this strictly necessary? - stateObject = s.state.GetStateObject(stateobjaddr) // set new state object value - stateObject.SetStorage(storageaddr, data2) + s.state.SetState(stateobjaddr, storageaddr, data2) // restore snapshot s.state.Set(snapshot) - // get state object - stateObject = s.state.GetStateObject(stateobjaddr) // get state storage value - res := stateObject.GetStorage(storageaddr) + res := s.state.GetState(stateobjaddr, storageaddr) c.Assert(data1, checker.DeepEquals, res) } |