From 4404e4bc3c0ac40791413374c66d6ed532900808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 22 Dec 2016 15:36:13 +0100 Subject: [PATCH] core/vm: decouple RunPrecompiled from EVM type --- core/vm/vm.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/vm/vm.go b/core/vm/vm.go index 3521839df5..1bba6da960 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -71,7 +71,7 @@ func (evm *EVM) Run(contract *Contract, input []byte) (ret []byte, err error) { if contract.CodeAddr != 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 } -// RunPrecompile runs and evaluate the output of a precompiled contract defined in contracts.go -func (evm *EVM) RunPrecompiled(p *PrecompiledAccount, input []byte, contract *Contract) (ret []byte, err error) { +// Runs and evaluates the output of a precompiled contract defined in contracts.go +func runPrecompiled(p *PrecompiledAccount, input []byte, contract *Contract) (ret []byte, err error) { gas := p.Gas(len(input)) if contract.UseGas(gas) { ret = p.Call(input) - return ret, nil } else { return nil, OutOfGasError