aboutsummaryrefslogtreecommitdiffstats
path: root/ethstate
diff options
context:
space:
mode:
Diffstat (limited to 'ethstate')
-rw-r--r--ethstate/state.go25
-rw-r--r--ethstate/state_object.go4
2 files changed, 29 insertions, 0 deletions
diff --git a/ethstate/state.go b/ethstate/state.go
index b897b7ce3..2efe2a311 100644
--- a/ethstate/state.go
+++ b/ethstate/state.go
@@ -48,6 +48,13 @@ func (self *State) GetNonce(addr []byte) uint64 {
return 0
}
+func (self *State) SetNonce(addr []byte, nonce uint64) {
+ stateObject := self.GetStateObject(addr)
+ if stateObject != nil {
+ stateObject.Nonce = nonce
+ }
+}
+
func (self *State) GetCode(addr []byte) []byte {
stateObject := self.GetStateObject(addr)
if stateObject != nil {
@@ -66,6 +73,24 @@ func (self *State) GetState(a, b []byte) []byte {
return nil
}
+func (self *State) SetState(addr, key []byte, value interface{}) {
+ stateObject := self.GetStateObject(addr)
+ if stateObject != nil {
+ stateObject.SetState(key, ethutil.NewValue(value))
+ }
+}
+
+func (self *State) Delete(addr []byte) bool {
+ stateObject := self.GetStateObject(addr)
+ if stateObject != nil {
+ stateObject.MarkForDeletion()
+
+ return true
+ }
+
+ return false
+}
+
//
// Setting, updating & deleting state object methods
//
diff --git a/ethstate/state_object.go b/ethstate/state_object.go
index 4d2aae1a7..a5b7c65e9 100644
--- a/ethstate/state_object.go
+++ b/ethstate/state_object.go
@@ -104,6 +104,10 @@ func (self *StateObject) SetStorage(key *big.Int, value *ethutil.Value) {
self.SetState(key.Bytes(), value)
}
+func (self *StateObject) Storage() map[string]*ethutil.Value {
+ return self.storage
+}
+
func (self *StateObject) GetState(k []byte) *ethutil.Value {
key := ethutil.LeftPadBytes(k, 32)