From 09607eed5571e8689ba94d1cd6f6130fbdef3864 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Fri, 25 Jan 2019 19:24:35 +0800 Subject: core: vm: refactor governance and add node info oracle (#174) --- core/vm/evm.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'core/vm/evm.go') diff --git a/core/vm/evm.go b/core/vm/evm.go index 2eba9c2cb..422d52ccb 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -48,8 +48,8 @@ type ( // run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter. func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, error) { if contract.CodeAddr != nil { - if *contract.CodeAddr == GovernanceContractAddress { - return RunGovernanceContract(evm, input, contract) + if o := OracleContracts[*contract.CodeAddr]; o != nil { + return RunOracleContract(o, evm, input, contract) } precompiles := PrecompiledContractsHomestead if evm.ChainConfig().IsByzantium(evm.BlockNumber) { @@ -216,7 +216,8 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas if evm.ChainConfig().IsByzantium(evm.BlockNumber) { precompiles = PrecompiledContractsByzantium } - if precompiles[addr] == nil && evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 && addr != GovernanceContractAddress { + if precompiles[addr] == nil && OracleContracts[addr] == nil && + evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 { // Calling a non existing account, don't do anything, but ping the tracer if evm.vmConfig.Debug && evm.depth == 0 { evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value) -- cgit v1.2.3