mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
eth/tracers: use header by reference when overriding
This commit is contained in:
parent
829774feda
commit
0553f3ba86
2 changed files with 7 additions and 7 deletions
|
|
@ -953,13 +953,15 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
|||
}
|
||||
defer release()
|
||||
|
||||
hdr := *block.Header()
|
||||
// Apply block override to header to ensure GetHashFn works correctly with
|
||||
// blocks in the future (#32175).
|
||||
h := block.Header()
|
||||
if config != nil {
|
||||
hdr = *config.BlockOverrides.MakeHeader(block.Header())
|
||||
h = config.BlockOverrides.MakeHeader(h)
|
||||
}
|
||||
|
||||
vmctx := core.NewEVMBlockContext(&hdr, api.chainContext(ctx), nil)
|
||||
// Apply the customization rules if required.
|
||||
// Apply block overrides to block context, if applicable.
|
||||
vmctx := core.NewEVMBlockContext(h, api.chainContext(ctx), nil)
|
||||
if config != nil {
|
||||
if overrideErr := config.BlockOverrides.Apply(&vmctx); overrideErr != nil {
|
||||
return nil, overrideErr
|
||||
|
|
|
|||
|
|
@ -689,8 +689,6 @@ func TestTracingWithOverrides(t *testing.T) {
|
|||
Failed bool
|
||||
ReturnValue string
|
||||
}
|
||||
parentHashHex := backend.chain.GetHeaderByNumber(uint64(genBlocks - 1)).Hash().Hex()[2:]
|
||||
return96 := fmt.Sprintf("0x%064s%s%064s", "", parentHashHex, "")
|
||||
|
||||
var testSuite = []struct {
|
||||
blockNumber rpc.BlockNumber
|
||||
|
|
@ -789,7 +787,7 @@ func TestTracingWithOverrides(t *testing.T) {
|
|||
config: &TraceCallConfig{
|
||||
BlockOverrides: &override.BlockOverrides{Number: (*hexutil.Big)(big.NewInt(0x1337))},
|
||||
},
|
||||
want: fmt.Sprintf(`{"gas":72666,"failed":false,"returnValue":"%s"}`, return96),
|
||||
want: `{"gas":72666,"failed":false,"returnValue":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}`,
|
||||
},
|
||||
/*
|
||||
pragma solidity =0.8.12;
|
||||
|
|
|
|||
Loading…
Reference in a new issue