mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
move precompile list to own func
This commit is contained in:
parent
d1ce690e76
commit
e23025876f
1 changed files with 13 additions and 9 deletions
|
|
@ -126,19 +126,15 @@ func (mc *multicall) execute(ctx context.Context, opts multicallOpts) ([]blockRe
|
|||
var (
|
||||
results = make([]blockResult, len(blocks))
|
||||
// Each tx and all the series of txes shouldn't consume more gas than cap
|
||||
globalGasCap = mc.b.RPCGasCap()
|
||||
gp = new(core.GasPool).AddGas(globalGasCap)
|
||||
header = base
|
||||
blockContext = core.NewEVMBlockContext(header, NewChainContext(ctx, mc.b), nil)
|
||||
rules = mc.b.ChainConfig().Rules(blockContext.BlockNumber, blockContext.Random != nil, blockContext.Time)
|
||||
precompiles = vm.ActivePrecompiledContracts(rules).Copy()
|
||||
gp = new(core.GasPool).AddGas(mc.b.RPCGasCap())
|
||||
precompiles = mc.activePrecompiles(ctx, base)
|
||||
numHashes = headers[len(headers)-1].Number.Uint64() - base.Number.Uint64() + 256
|
||||
)
|
||||
// Cache for the block hashes.
|
||||
mc.hashes = make([]common.Hash, numHashes)
|
||||
for bi, block := range blocks {
|
||||
header = headers[bi]
|
||||
blockContext = core.NewEVMBlockContext(header, NewChainContext(ctx, mc.b), nil)
|
||||
header := headers[bi]
|
||||
blockContext := core.NewEVMBlockContext(header, NewChainContext(ctx, mc.b), nil)
|
||||
// Respond to BLOCKHASH requests.
|
||||
blockContext.GetHash = func(n uint64) common.Hash {
|
||||
h, err := mc.getBlockHash(ctx, n, base, headers)
|
||||
|
|
@ -288,6 +284,14 @@ func (mc *multicall) computeBlockHash(ctx context.Context, n uint64, base *types
|
|||
return common.Hash{}, errors.New("requested block is in future")
|
||||
}
|
||||
|
||||
func (mc *multicall) activePrecompiles(ctx context.Context, base *types.Header) vm.PrecompiledContracts {
|
||||
var (
|
||||
blockContext = core.NewEVMBlockContext(base, NewChainContext(ctx, mc.b), nil)
|
||||
rules = mc.b.ChainConfig().Rules(blockContext.BlockNumber, blockContext.Random != nil, blockContext.Time)
|
||||
)
|
||||
return vm.ActivePrecompiledContracts(rules).Copy()
|
||||
}
|
||||
|
||||
// repairLogs updates the block hash in the logs present in a multicall
|
||||
// result object. This is needed as during execution when logs are collected
|
||||
// the block hash is not known.
|
||||
|
|
|
|||
Loading…
Reference in a new issue