cmd, core, internal, light, tests: avoid hashing the code in the VM

This commit is contained in:
Péter Szilágyi
2016-10-01 15:44:53 +03:00
parent d8715fba1a
commit cb84e3f029
17 changed files with 59 additions and 37 deletions

View File

@ -27,7 +27,7 @@ type ContractRef interface {
ReturnGas(*big.Int, *big.Int)
Address() common.Address
Value() *big.Int
SetCode([]byte)
SetCode(common.Hash, []byte)
ForEachStorage(callback func(key, value common.Hash) bool)
}
@ -44,8 +44,9 @@ type Contract struct {
jumpdests destinations // result of JUMPDEST analysis.
Code []byte
Input []byte
CodeHash common.Hash
CodeAddr *common.Address
Input []byte
value, Gas, UsedGas, Price *big.Int
@ -143,14 +144,16 @@ func (c *Contract) Value() *big.Int {
}
// SetCode sets the code to the contract
func (self *Contract) SetCode(code []byte) {
func (self *Contract) SetCode(hash common.Hash, code []byte) {
self.Code = code
self.CodeHash = hash
}
// SetCallCode sets the code of the contract and address of the backing data
// object
func (self *Contract) SetCallCode(addr *common.Address, code []byte) {
func (self *Contract) SetCallCode(addr *common.Address, hash common.Hash, code []byte) {
self.Code = code
self.CodeHash = hash
self.CodeAddr = addr
}