This commit is contained in:
Paweł Bylica 2017-01-05 10:46:50 +00:00 committed by GitHub
commit 317cc23205

View file

@ -71,7 +71,7 @@ func (evm *EVM) Run(contract *Contract, input []byte) (ret []byte, err error) {
if contract.CodeAddr != nil { if contract.CodeAddr != nil {
if p := Precompiled[contract.CodeAddr.Str()]; p != nil { if p := Precompiled[contract.CodeAddr.Str()]; p != nil {
return evm.RunPrecompiled(p, input, contract) return runPrecompiled(p, input, contract)
} }
} }
@ -454,12 +454,11 @@ func calculateGasAndSize(gasTable params.GasTable, env *Environment, contract *C
return newMemSize, gas, nil return newMemSize, gas, nil
} }
// RunPrecompile runs and evaluate the output of a precompiled contract defined in contracts.go // Runs and evaluates the output of a precompiled contract defined in contracts.go
func (evm *EVM) RunPrecompiled(p *PrecompiledAccount, input []byte, contract *Contract) (ret []byte, err error) { func runPrecompiled(p *PrecompiledAccount, input []byte, contract *Contract) (ret []byte, err error) {
gas := p.Gas(len(input)) gas := p.Gas(len(input))
if contract.UseGas(gas) { if contract.UseGas(gas) {
ret = p.Call(input) ret = p.Call(input)
return ret, nil return ret, nil
} else { } else {
return nil, OutOfGasError return nil, OutOfGasError