forked from forks/go-ethereum
eth: fix returned blockContext for empty blocks in stateAtTransaction (#31768)
Co-authored-by: lightclient <lightclient@protonmail.com>
This commit is contained in:
parent
2cd5f22037
commit
c53db5e1f6
1 changed files with 8 additions and 2 deletions
|
|
@ -217,7 +217,13 @@ func (eth *Ethereum) stateAtBlock(ctx context.Context, block *types.Block, reexe
|
|||
return eth.pathState(block)
|
||||
}
|
||||
|
||||
// stateAtTransaction returns the execution environment of a certain transaction.
|
||||
// stateAtTransaction returns the execution environment of a certain
|
||||
// transaction.
|
||||
//
|
||||
// Note: when a block is empty and the state for tx index 0 is requested, this
|
||||
// function will return the state of block after the pre-block operations have
|
||||
// been completed (e.g. updating system contracts), but before post-block
|
||||
// operations are completed (e.g. processing withdrawals).
|
||||
func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (*types.Transaction, vm.BlockContext, *state.StateDB, tracers.StateReleaseFunc, error) {
|
||||
// Short circuit if it's genesis block.
|
||||
if block.NumberU64() == 0 {
|
||||
|
|
@ -245,7 +251,7 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
|
|||
core.ProcessParentBlockHash(block.ParentHash(), evm)
|
||||
}
|
||||
if txIndex == 0 && len(block.Transactions()) == 0 {
|
||||
return nil, vm.BlockContext{}, statedb, release, nil
|
||||
return nil, context, statedb, release, nil
|
||||
}
|
||||
// Recompute transactions up to the target index.
|
||||
signer := types.MakeSigner(eth.blockchain.Config(), block.Number(), block.Time())
|
||||
|
|
|
|||
Loading…
Reference in a new issue