|
|
@ -57,8 +57,6 @@ type StateObject struct { |
|
|
|
initCode Code |
|
|
|
initCode Code |
|
|
|
// Cached storage (flushed when updated)
|
|
|
|
// Cached storage (flushed when updated)
|
|
|
|
storage Storage |
|
|
|
storage Storage |
|
|
|
// Temporary prepaid gas, reward after transition
|
|
|
|
|
|
|
|
prepaid *big.Int |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Total gas pool is the total amount of gas currently
|
|
|
|
// Total gas pool is the total amount of gas currently
|
|
|
|
// left if this object is the coinbase. Gas is directly
|
|
|
|
// left if this object is the coinbase. Gas is directly
|
|
|
@ -77,14 +75,10 @@ func (self *StateObject) Reset() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewStateObject(address common.Address, db common.Database) *StateObject { |
|
|
|
func NewStateObject(address common.Address, db common.Database) *StateObject { |
|
|
|
// This to ensure that it has 20 bytes (and not 0 bytes), thus left or right pad doesn't matter.
|
|
|
|
|
|
|
|
//address := common.ToAddress(addr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object := &StateObject{db: db, address: address, balance: new(big.Int), gasPool: new(big.Int), dirty: true} |
|
|
|
object := &StateObject{db: db, address: address, balance: new(big.Int), gasPool: new(big.Int), dirty: true} |
|
|
|
object.trie = trie.NewSecure((common.Hash{}).Bytes(), db) |
|
|
|
object.trie = trie.NewSecure((common.Hash{}).Bytes(), db) |
|
|
|
object.storage = make(Storage) |
|
|
|
object.storage = make(Storage) |
|
|
|
object.gasPool = new(big.Int) |
|
|
|
object.gasPool = new(big.Int) |
|
|
|
object.prepaid = new(big.Int) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return object |
|
|
|
return object |
|
|
|
} |
|
|
|
} |
|
|
@ -110,7 +104,6 @@ func NewStateObjectFromBytes(address common.Address, data []byte, db common.Data |
|
|
|
object.trie = trie.NewSecure(extobject.Root[:], db) |
|
|
|
object.trie = trie.NewSecure(extobject.Root[:], db) |
|
|
|
object.storage = make(map[string]common.Hash) |
|
|
|
object.storage = make(map[string]common.Hash) |
|
|
|
object.gasPool = new(big.Int) |
|
|
|
object.gasPool = new(big.Int) |
|
|
|
object.prepaid = new(big.Int) |
|
|
|
|
|
|
|
object.code, _ = db.Get(extobject.CodeHash) |
|
|
|
object.code, _ = db.Get(extobject.CodeHash) |
|
|
|
|
|
|
|
|
|
|
|
return object |
|
|
|
return object |
|
|
@ -172,7 +165,6 @@ func (self *StateObject) Update() { |
|
|
|
|
|
|
|
|
|
|
|
self.setAddr([]byte(key), value) |
|
|
|
self.setAddr([]byte(key), value) |
|
|
|
} |
|
|
|
} |
|
|
|
self.storage = make(Storage) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (c *StateObject) GetInstr(pc *big.Int) *common.Value { |
|
|
|
func (c *StateObject) GetInstr(pc *big.Int) *common.Value { |
|
|
|