mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
safer api for getting active precompiles
This commit is contained in:
parent
7fff1c40ef
commit
bf7809495f
2 changed files with 7 additions and 3 deletions
|
|
@ -159,8 +159,7 @@ func (p PrecompiledContracts) Copy() PrecompiledContracts {
|
|||
return c
|
||||
}
|
||||
|
||||
// ActivePrecompiledContracts returns precompiled contracts enabled with the current configuration.
|
||||
func ActivePrecompiledContracts(rules params.Rules) PrecompiledContracts {
|
||||
func activePrecompiledContracts(rules params.Rules) PrecompiledContracts {
|
||||
switch {
|
||||
case rules.IsCancun:
|
||||
return PrecompiledContractsCancun
|
||||
|
|
@ -175,6 +174,11 @@ func ActivePrecompiledContracts(rules params.Rules) PrecompiledContracts {
|
|||
}
|
||||
}
|
||||
|
||||
// ActivePrecompiledContracts returns a copy of precompiled contracts enabled with the current configuration.
|
||||
func ActivePrecompiledContracts(rules params.Rules) PrecompiledContracts {
|
||||
return activePrecompiledContracts(rules).Copy()
|
||||
}
|
||||
|
||||
// ActivePrecompiles returns the precompile addresses enabled with the current configuration.
|
||||
func ActivePrecompiles(rules params.Rules) []common.Address {
|
||||
switch {
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
|
|||
chainConfig: chainConfig,
|
||||
chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time),
|
||||
}
|
||||
evm.precompiles = ActivePrecompiledContracts(evm.chainRules)
|
||||
evm.precompiles = activePrecompiledContracts(evm.chainRules)
|
||||
evm.interpreter = NewEVMInterpreter(evm)
|
||||
return evm
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue