diff --git a/cmd/rpcdaemon/commands/call_traces_test.go b/cmd/rpcdaemon/commands/call_traces_test.go index a8c7f899f7d..f4f1693c5dc 100644 --- a/cmd/rpcdaemon/commands/call_traces_test.go +++ b/cmd/rpcdaemon/commands/call_traces_test.go @@ -75,7 +75,7 @@ func TestCallTraceOneByOne(t *testing.T) { ToBlock: (*hexutil.Uint64)(&toBlock), ToAddress: []*common.Address{&toAddress1}, } - if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer())) @@ -120,7 +120,7 @@ func TestCallTraceUnwind(t *testing.T) { ToBlock: (*hexutil.Uint64)(&toBlock), ToAddress: []*common.Address{&toAddress1}, } - if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer())) @@ -135,7 +135,7 @@ func TestCallTraceUnwind(t *testing.T) { ToBlock: (*hexutil.Uint64)(&toBlock), ToAddress: []*common.Address{&toAddress1}, } - if err = api.Filter(context.Background(), traceReq2, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq2, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{1, 2, 3, 4, 5, 11, 12}, blockNumbersFromTraces(t, stream.Buffer())) @@ -151,7 +151,7 @@ func TestCallTraceUnwind(t *testing.T) { ToBlock: (*hexutil.Uint64)(&toBlock), ToAddress: []*common.Address{&toAddress1}, } - if err = api.Filter(context.Background(), traceReq3, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq3, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{12, 13, 14, 15, 16, 17, 18, 19, 20}, blockNumbersFromTraces(t, stream.Buffer())) @@ -183,7 +183,7 @@ func TestFilterNoAddresses(t *testing.T) { FromBlock: (*hexutil.Uint64)(&fromBlock), ToBlock: (*hexutil.Uint64)(&toBlock), } - if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer())) @@ -234,7 +234,7 @@ func TestFilterAddressIntersection(t *testing.T) { ToAddress: []*common.Address{&m.Address, &toAddress2}, Mode: TraceFilterModeIntersection, } - if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer())) @@ -250,7 +250,7 @@ func TestFilterAddressIntersection(t *testing.T) { ToAddress: []*common.Address{&toAddress1, &m.Address}, Mode: TraceFilterModeIntersection, } - if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } assert.Equal(t, []int{1, 2, 3, 4, 5}, blockNumbersFromTraces(t, stream.Buffer())) @@ -266,7 +266,7 @@ func TestFilterAddressIntersection(t *testing.T) { FromAddress: []*common.Address{&toAddress2, &toAddress1, &other}, Mode: TraceFilterModeIntersection, } - if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil { + if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil { t.Fatalf("trace_filter failed: %v", err) } require.Empty(t, blockNumbersFromTraces(t, stream.Buffer())) diff --git a/cmd/rpcdaemon/commands/trace_api.go b/cmd/rpcdaemon/commands/trace_api.go index a75daa6105e..c39ded33205 100644 --- a/cmd/rpcdaemon/commands/trace_api.go +++ b/cmd/rpcdaemon/commands/trace_api.go @@ -26,7 +26,7 @@ type TraceAPI interface { Transaction(ctx context.Context, txHash libcommon.Hash, gasBailOut *bool) (ParityTraces, error) Get(ctx context.Context, txHash libcommon.Hash, txIndicies []hexutil.Uint64, gasBailOut *bool) (*ParityTrace, error) Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool) (ParityTraces, error) - Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream, gasBailOut *bool) error + Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, stream *jsoniter.Stream) error } // TraceAPIImpl is implementation of the TraceAPI interface based on remote Db access diff --git a/cmd/rpcdaemon/commands/trace_filtering.go b/cmd/rpcdaemon/commands/trace_filtering.go index c96d3c0eeaa..2b362dd242a 100644 --- a/cmd/rpcdaemon/commands/trace_filtering.go +++ b/cmd/rpcdaemon/commands/trace_filtering.go @@ -338,7 +338,7 @@ func traceFilterBitmapsV3(tx kv.TemporalTx, req TraceFilterRequest, from, to uin // Filter implements trace_filter // NOTE: We do not store full traces - we just store index for each address // Pull blocks which have txs with matching address -func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream, gasBailOut *bool) error { +func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, stream *jsoniter.Stream) error { if gasBailOut == nil { gasBailOut = new(bool) // false by default }