From f616a39b6acb3d3274177fc1edef5f9d7c14b86b Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 3 Oct 2018 16:02:45 +0200 Subject: [PATCH] eth: more elegant api_tracer --- eth/api_tracer.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eth/api_tracer.go b/eth/api_tracer.go index e61720b0ba..80552ada8c 100644 --- a/eth/api_tracer.go +++ b/eth/api_tracer.go @@ -394,9 +394,8 @@ func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, // TraceBadBlock returns the structured logs created during the execution of a block // within the blockchain 'badblocks' cache func (api *PrivateDebugAPI) TraceBadBlock(ctx context.Context, index int, config *TraceConfig) ([]*txTraceResult, error) { - badBlocks := api.eth.blockchain.BadBlocks() - if l := len(badBlocks); index < l { - return api.traceBlock(ctx, badBlocks[index], config) + if blocks := api.eth.blockchain.BadBlocks(); index < len(blocks) { + return api.traceBlock(ctx, blocks[index], config) } return nil, fmt.Errorf("index out of range") }