feat: include fee vault address in trace api result (#208)

* include fee vault address in trace api result

* use fee vault instead of coinbase if exists

* retrigger checks

* Update api_blocktrace_test.go

---------

Co-authored-by: maskpp <maskpp266@gmail.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
Nazarii Denha 2023-02-10 08:13:46 +01:00 committed by GitHub
parent 7c3657b61b
commit aae2ea53df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View file

@ -94,9 +94,14 @@ func (api *API) createTraceEnv(ctx context.Context, config *TraceConfig, block *
}
// get coinbase
coinbase, err := api.backend.Engine().Author(block.Header())
if err != nil {
return nil, err
var coinbase common.Address
if api.backend.ChainConfig().FeeVaultAddress != nil {
coinbase = *api.backend.ChainConfig().FeeVaultAddress
} else {
coinbase, err = api.backend.Engine().Author(block.Header())
if err != nil {
return nil, err
}
}
env := &traceEnv{
@ -127,6 +132,7 @@ func (api *API) createTraceEnv(ctx context.Context, config *TraceConfig, block *
}
env.Proofs[key] = wrappedProof
}
return env, nil
}

View file

@ -180,10 +180,15 @@ func checkStructLogs(t *testing.T, expect []*txTraceResult, actual []*types.Exec
}
func checkCoinbase(t *testing.T, b *testBackend, wrapper *types.AccountWrapper) {
header, err := b.HeaderByNumber(context.Background(), 1)
assert.NoError(t, err)
coinbase, err := b.engine.Author(header)
assert.NoError(t, err)
var coinbase common.Address
if b.chainConfig.FeeVaultAddress != nil {
coinbase = *b.chainConfig.FeeVaultAddress
} else {
header, err := b.HeaderByNumber(context.Background(), 1)
assert.NoError(t, err)
coinbase, err = b.engine.Author(header)
assert.NoError(t, err)
}
assert.Equal(t, true, coinbase.String() == wrapper.Address.String())
}