mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
miner, core: reuse the chain's jumpdest cache when building payloads
This commit is contained in:
parent
c3f2851872
commit
4b457025b5
2 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue