This commit is contained in:
Jonny Rhea 2026-07-17 12:51:52 -05:00 committed by GitHub
commit 1c119548fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -524,6 +524,12 @@ func (bc *BlockChain) CodeDB() *state.CodeDB {
return bc.codedb
}
// JumpDestCache retrieves the shared JUMPDEST analysis cache, so callers such
// as the miner can reuse bitmaps already computed during block import.
func (bc *BlockChain) JumpDestCache() vm.JumpDestCache {
return bc.jumpDestCache
}
// HeaderChain returns the underlying header chain.
func (bc *BlockChain) HeaderChain() *HeaderChain {
return bc.hc

View file

@ -345,6 +345,8 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
}
}
state.StartPrefetcher("miner", bundle)
evm := vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{})
evm.SetJumpDestCache(miner.chain.JumpDestCache())
// Note the passed coinbase may be different with header.Coinbase.
return &environment{
@ -356,7 +358,7 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
header: header,
bal: bal.NewConstructionBlockAccessList(),
witness: state.Witness(),
evm: vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{}),
evm: evm,
}, nil
}