aboutsummaryrefslogtreecommitdiffstats
path: root/ethstate/state_object.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethstate/state_object.go')
-rw-r--r--ethstate/state_object.go24
1 files changed, 3 insertions, 21 deletions
diff --git a/ethstate/state_object.go b/ethstate/state_object.go
index 5932fbee6..309e3e762 100644
--- a/ethstate/state_object.go
+++ b/ethstate/state_object.go
@@ -57,30 +57,12 @@ func (self *StateObject) Reset() {
self.State.Reset()
}
-/*
-// Converts an transaction in to a state object
-func MakeContract(tx *Transaction, state *State) *StateObject {
- // Create contract if there's no recipient
- if tx.IsContract() {
- addr := tx.CreationAddress()
-
- contract := state.NewStateObject(addr)
- contract.initCode = tx.Data
- contract.state = NewState(ethtrie.NewTrie(ethutil.Config.Db, ""))
-
- return contract
- }
-
- return nil
-}
-*/
-
func NewStateObject(addr []byte) *StateObject {
// This to ensure that it has 20 bytes (and not 0 bytes), thus left or right pad doesn't matter.
address := ethutil.Address(addr)
object := &StateObject{address: address, Balance: new(big.Int), gasPool: new(big.Int)}
- object.State = NewState(ethtrie.NewTrie(ethutil.Config.Db, ""))
+ object.State = NewState(ethtrie.New(ethutil.Config.Db, ""))
object.storage = make(Storage)
object.gasPool = new(big.Int)
@@ -90,7 +72,7 @@ func NewStateObject(addr []byte) *StateObject {
func NewContract(address []byte, balance *big.Int, root []byte) *StateObject {
contract := NewStateObject(address)
contract.Balance = balance
- contract.State = NewState(ethtrie.NewTrie(ethutil.Config.Db, string(root)))
+ contract.State = NewState(ethtrie.New(ethutil.Config.Db, string(root)))
return contract
}
@@ -318,7 +300,7 @@ func (c *StateObject) RlpDecode(data []byte) {
c.Nonce = decoder.Get(0).Uint()
c.Balance = decoder.Get(1).BigInt()
- c.State = NewState(ethtrie.NewTrie(ethutil.Config.Db, decoder.Get(2).Interface()))
+ c.State = NewState(ethtrie.New(ethutil.Config.Db, decoder.Get(2).Interface()))
c.storage = make(map[string]*ethutil.Value)
c.gasPool = new(big.Int)