diff options
Diffstat (limited to 'ethstate')
-rw-r--r-- | ethstate/state.go | 9 | ||||
-rw-r--r-- | ethstate/state_object.go | 10 |
2 files changed, 13 insertions, 6 deletions
diff --git a/ethstate/state.go b/ethstate/state.go index c2486849b..b897b7ce3 100644 --- a/ethstate/state.go +++ b/ethstate/state.go @@ -57,6 +57,15 @@ func (self *State) GetCode(addr []byte) []byte { return nil } +func (self *State) GetState(a, b []byte) []byte { + stateObject := self.GetStateObject(a) + if stateObject != nil { + return stateObject.GetState(b).Bytes() + } + + return nil +} + // // Setting, updating & deleting state object methods // diff --git a/ethstate/state_object.go b/ethstate/state_object.go index fe4c5f73b..4d2aae1a7 100644 --- a/ethstate/state_object.go +++ b/ethstate/state_object.go @@ -98,13 +98,13 @@ func (c *StateObject) SetAddr(addr []byte, value interface{}) { } func (self *StateObject) GetStorage(key *big.Int) *ethutil.Value { - return self.getStorage(key.Bytes()) + return self.GetState(key.Bytes()) } func (self *StateObject) SetStorage(key *big.Int, value *ethutil.Value) { - self.setStorage(key.Bytes(), value) + self.SetState(key.Bytes(), value) } -func (self *StateObject) getStorage(k []byte) *ethutil.Value { +func (self *StateObject) GetState(k []byte) *ethutil.Value { key := ethutil.LeftPadBytes(k, 32) value := self.storage[string(key)] @@ -117,11 +117,9 @@ func (self *StateObject) getStorage(k []byte) *ethutil.Value { } return value - - //return self.GetAddr(key) } -func (self *StateObject) setStorage(k []byte, value *ethutil.Value) { +func (self *StateObject) SetState(k []byte, value *ethutil.Value) { key := ethutil.LeftPadBytes(k, 32) self.storage[string(key)] = value.Copy() } |