aboutsummaryrefslogtreecommitdiffstats
path: root/state
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-17 06:48:18 +0800
committerobscuren <geffobscura@gmail.com>2015-03-17 06:48:18 +0800
commit8ce6a3647821706cf5e9bb1a9dc13f23c84f6585 (patch)
treebb96f374054efc6c830e98c11dc4b91b5313056f /state
parent94505146a21cc0aee16d79aebc17c8fcb1f91324 (diff)
downloadgo-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.tar
go-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.tar.gz
go-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.tar.bz2
go-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.tar.lz
go-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.tar.xz
go-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.tar.zst
go-tangerine-8ce6a3647821706cf5e9bb1a9dc13f23c84f6585.zip
converted chain manager
Diffstat (limited to 'state')
-rw-r--r--state/state_object.go6
-rw-r--r--state/statedb.go10
2 files changed, 8 insertions, 8 deletions
diff --git a/state/state_object.go b/state/state_object.go
index 853703350..a7c20722c 100644
--- a/state/state_object.go
+++ b/state/state_object.go
@@ -82,7 +82,7 @@ func NewStateObject(address common.Address, db common.Database) *StateObject {
//address := common.ToAddress(addr)
object := &StateObject{db: db, address: address, balance: new(big.Int), gasPool: new(big.Int), dirty: true}
- object.State = New(nil, db) //New(trie.New(common.Config.Db, ""))
+ object.State = New(common.Hash{}, db) //New(trie.New(common.Config.Db, ""))
object.storage = make(Storage)
object.gasPool = new(big.Int)
object.prepaid = new(big.Int)
@@ -109,7 +109,7 @@ func NewStateObjectFromBytes(address common.Address, data []byte, db common.Data
object.nonce = extobject.Nonce
object.balance = extobject.Balance
object.codeHash = extobject.CodeHash
- object.State = New(extobject.Root[:], db)
+ object.State = New(extobject.Root, db)
object.storage = make(map[string]*common.Value)
object.gasPool = new(big.Int)
object.prepaid = new(big.Int)
@@ -339,7 +339,7 @@ func (c *StateObject) RlpDecode(data []byte) {
decoder := common.NewValueFromBytes(data)
c.nonce = decoder.Get(0).Uint()
c.balance = decoder.Get(1).BigInt()
- c.State = New(decoder.Get(2).Bytes(), c.db) //New(trie.New(common.Config.Db, decoder.Get(2).Interface()))
+ c.State = New(common.BytesToHash(decoder.Get(2).Bytes()), c.db) //New(trie.New(common.Config.Db, decoder.Get(2).Interface()))
c.storage = make(map[string]*common.Value)
c.gasPool = new(big.Int)
diff --git a/state/statedb.go b/state/statedb.go
index 85fabac78..ea5aad525 100644
--- a/state/statedb.go
+++ b/state/statedb.go
@@ -28,8 +28,8 @@ type StateDB struct {
}
// Create a new state from a given trie
-func New(root []byte, db common.Database) *StateDB {
- trie := trie.NewSecure(common.CopyBytes(root), db)
+func New(root common.Hash, db common.Database) *StateDB {
+ trie := trie.NewSecure(root[:], db)
return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), refund: make(map[string]*big.Int)}
}
@@ -222,7 +222,7 @@ func (s *StateDB) Cmp(other *StateDB) bool {
}
func (self *StateDB) Copy() *StateDB {
- state := New(nil, self.db)
+ state := New(common.Hash{}, self.db)
state.trie = self.trie.Copy()
for k, stateObject := range self.stateObjects {
state.stateObjects[k] = stateObject.Copy()
@@ -247,8 +247,8 @@ func (self *StateDB) Set(state *StateDB) {
self.logs = state.logs
}
-func (s *StateDB) Root() []byte {
- return s.trie.Root()
+func (s *StateDB) Root() common.Hash {
+ return common.BytesToHash(s.trie.Root())
}
func (s *StateDB) Trie() *trie.SecureTrie {