Skip to content

Commit

Permalink
Fix debug_traceBlock - prevent garbage collecting of EvmHeader ref
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalina committed Apr 8, 2022
1 parent e1cea27 commit a826ce8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions evmcore/evm.go
Expand Up @@ -48,7 +48,7 @@ func NewEVMBlockContext(header *EvmHeader, chain DummyChain, author *common.Addr
return vm.BlockContext{
CanTransfer: CanTransfer,
Transfer: Transfer,
GetHash: GetHashFn(header, chain),
GetHash: GetHashFn(*header, chain),
Coinbase: beneficiary,
BlockNumber: new(big.Int).Set(header.Number),
Time: new(big.Int).SetUint64(uint64(header.Time.Unix())),
Expand All @@ -67,7 +67,7 @@ func NewEVMTxContext(msg Message) vm.TxContext {
}

// GetHashFn returns a GetHashFunc which retrieves header hashes by number
func GetHashFn(ref *EvmHeader, chain DummyChain) func(n uint64) common.Hash {
func GetHashFn(ref EvmHeader, chain DummyChain) func(n uint64) common.Hash {
// Cache will initially contain [refHash.parent],
// Then fill up with [refHash.p, refHash.pp, refHash.ppp, ...]
var cache []common.Hash
Expand Down

0 comments on commit a826ce8

Please sign in to comment.