|
@@ -87,10 +87,6 @@ type StateObject struct {
|
|
|
dirty bool
|
|
dirty bool
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (self *StateObject) Reset() {
|
|
|
|
|
- self.storage = make(Storage)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func NewStateObject(address common.Address, db common.Database) *StateObject {
|
|
func NewStateObject(address common.Address, db common.Database) *StateObject {
|
|
|
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)
|
|
@@ -184,14 +180,6 @@ func (self *StateObject) Update() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (c *StateObject) GetInstr(pc *big.Int) *common.Value {
|
|
|
|
|
- if int64(len(c.code)-1) < pc.Int64() {
|
|
|
|
|
- return common.NewValue(0)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return common.NewValueFromBytes([]byte{c.code[pc.Int64()]})
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (c *StateObject) AddBalance(amount *big.Int) {
|
|
func (c *StateObject) AddBalance(amount *big.Int) {
|
|
|
c.SetBalance(new(big.Int).Add(c.balance, amount))
|
|
c.SetBalance(new(big.Int).Add(c.balance, amount))
|
|
|
|
|
|
|
@@ -268,10 +256,6 @@ func (self *StateObject) Copy() *StateObject {
|
|
|
return stateObject
|
|
return stateObject
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (self *StateObject) Set(stateObject *StateObject) {
|
|
|
|
|
- *self = *stateObject
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
//
|
|
//
|
|
|
// Attribute accessors
|
|
// Attribute accessors
|
|
|
//
|
|
//
|
|
@@ -280,20 +264,11 @@ func (self *StateObject) Balance() *big.Int {
|
|
|
return self.balance
|
|
return self.balance
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (c *StateObject) N() *big.Int {
|
|
|
|
|
- return big.NewInt(int64(c.nonce))
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// Returns the address of the contract/account
|
|
// Returns the address of the contract/account
|
|
|
func (c *StateObject) Address() common.Address {
|
|
func (c *StateObject) Address() common.Address {
|
|
|
return c.address
|
|
return c.address
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// Returns the initialization Code
|
|
|
|
|
-func (c *StateObject) Init() Code {
|
|
|
|
|
- return c.initCode
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (self *StateObject) Trie() *trie.SecureTrie {
|
|
func (self *StateObject) Trie() *trie.SecureTrie {
|
|
|
return self.trie
|
|
return self.trie
|
|
|
}
|
|
}
|
|
@@ -311,11 +286,6 @@ func (self *StateObject) SetCode(code []byte) {
|
|
|
self.dirty = true
|
|
self.dirty = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (self *StateObject) SetInitCode(code []byte) {
|
|
|
|
|
- self.initCode = code
|
|
|
|
|
- self.dirty = true
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (self *StateObject) SetNonce(nonce uint64) {
|
|
func (self *StateObject) SetNonce(nonce uint64) {
|
|
|
self.nonce = nonce
|
|
self.nonce = nonce
|
|
|
self.dirty = true
|
|
self.dirty = true
|
|
@@ -354,19 +324,6 @@ func (c *StateObject) CodeHash() common.Bytes {
|
|
|
return crypto.Sha3(c.code)
|
|
return crypto.Sha3(c.code)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (c *StateObject) RlpDecode(data []byte) {
|
|
|
|
|
- decoder := common.NewValueFromBytes(data)
|
|
|
|
|
- c.nonce = decoder.Get(0).Uint()
|
|
|
|
|
- c.balance = decoder.Get(1).BigInt()
|
|
|
|
|
- c.trie = trie.NewSecure(decoder.Get(2).Bytes(), c.db)
|
|
|
|
|
- c.storage = make(map[string]common.Hash)
|
|
|
|
|
- c.gasPool = new(big.Int)
|
|
|
|
|
-
|
|
|
|
|
- c.codeHash = decoder.Get(3).Bytes()
|
|
|
|
|
-
|
|
|
|
|
- c.code, _ = c.db.Get(c.codeHash)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// Storage change object. Used by the manifest for notifying changes to
|
|
// Storage change object. Used by the manifest for notifying changes to
|
|
|
// the sub channels.
|
|
// the sub channels.
|
|
|
type StorageState struct {
|
|
type StorageState struct {
|