aboutsummaryrefslogtreecommitdiffstats
path: root/state
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-19 21:31:41 +0800
committerobscuren <geffobscura@gmail.com>2015-03-19 21:31:41 +0800
commitd4e5747d040f290eb3697ded891619887a8593da (patch)
tree4df57f053b3a4dd7b7dde4fde3d4ddeafd14f98e /state
parente13c6739804604849c7e43d27b073e68fba58191 (diff)
parentcf45b939a098c9421092226d5c76dbce34eb2dda (diff)
downloadgo-tangerine-d4e5747d040f290eb3697ded891619887a8593da.tar
go-tangerine-d4e5747d040f290eb3697ded891619887a8593da.tar.gz
go-tangerine-d4e5747d040f290eb3697ded891619887a8593da.tar.bz2
go-tangerine-d4e5747d040f290eb3697ded891619887a8593da.tar.lz
go-tangerine-d4e5747d040f290eb3697ded891619887a8593da.tar.xz
go-tangerine-d4e5747d040f290eb3697ded891619887a8593da.tar.zst
go-tangerine-d4e5747d040f290eb3697ded891619887a8593da.zip
Merge branch 'develop' into conversion
Diffstat (limited to 'state')
-rw-r--r--state/dump.go1
-rw-r--r--state/state_test.go18
-rw-r--r--state/statedb.go4
3 files changed, 23 insertions, 0 deletions
diff --git a/state/dump.go b/state/dump.go
index db05fae0c..712f8da1f 100644
--- a/state/dump.go
+++ b/state/dump.go
@@ -35,6 +35,7 @@ func (self *StateDB) RawDump() World {
storageIt := stateObject.State.trie.Iterator()
for storageIt.Next() {
+ fmt.Println("value", storageIt.Value)
account.Storage[common.Bytes2Hex(storageIt.Key)] = common.Bytes2Hex(storageIt.Value)
}
world.Accounts[common.Bytes2Hex(it.Key)] = account
diff --git a/state/state_test.go b/state/state_test.go
index 486baca43..b6e22f891 100644
--- a/state/state_test.go
+++ b/state/state_test.go
@@ -1,7 +1,9 @@
package state
import (
+ "fmt"
"math/big"
+ "testing"
checker "gopkg.in/check.v1"
@@ -62,6 +64,22 @@ func (s *StateSuite) SetUpTest(c *checker.C) {
s.state = New(nil, db)
}
+func TestNull(t *testing.T) {
+ db, _ := ethdb.NewMemDatabase()
+ state := New(nil, db)
+
+ address := common.FromHex("0x823140710bf13990e4500136726d8b55")
+ state.NewStateObject(address)
+ //value := common.FromHex("0x823140710bf13990e4500136726d8b55")
+ value := make([]byte, 16)
+ fmt.Println("test it here", common.NewValue(value))
+ state.SetState(address, []byte{0}, value)
+ state.Update(nil)
+ state.Sync()
+ value = state.GetState(address, []byte{0})
+ fmt.Printf("res: %x\n", value)
+}
+
func (s *StateSuite) TestSnapshot(c *checker.C) {
stateobjaddr := toAddr([]byte("aa"))
storageaddr := common.Big("0")
diff --git a/state/statedb.go b/state/statedb.go
index ea5aad525..6fcd39dbc 100644
--- a/state/statedb.go
+++ b/state/statedb.go
@@ -33,6 +33,10 @@ func New(root common.Hash, db common.Database) *StateDB {
return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), refund: make(map[string]*big.Int)}
}
+func (self *StateDB) PrintRoot() {
+ self.trie.Trie.PrintRoot()
+}
+
func (self *StateDB) EmptyLogs() {
self.logs = nil
}