From c6123af9bca4cf786fac6504e25fffb6e2faa28c Mon Sep 17 00:00:00 2001 From: Iuga Mihai Date: Fri, 8 Mar 2024 15:56:50 +0200 Subject: [PATCH] fixes after review --- process/elasticproc/elasticProcessor_test.go | 5 +++++ process/elasticproc/logsevents/logsAndEventsProcessor.go | 6 +++--- .../elasticproc/logsevents/logsAndEventsProcessor_test.go | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/process/elasticproc/elasticProcessor_test.go b/process/elasticproc/elasticProcessor_test.go index b6ff8eec..9f3311af 100644 --- a/process/elasticproc/elasticProcessor_test.go +++ b/process/elasticproc/elasticProcessor_test.go @@ -468,6 +468,11 @@ func TestElasticProcessor_RemoveTransactions(t *testing.T) { require.True(t, strings.Contains(bodyStr, expectedHashes[0])) require.True(t, strings.Contains(bodyStr, expectedHashes[1])) called = true + } else { + require.Equal(t, + `{"query": {"bool": {"must": [{"match": {"shardID": {"query": 4294967295,"operator": "AND"}}},{"match": {"timestamp": {"query": "0","operator": "AND"}}}]}}}`, + body.String(), + ) } return nil diff --git a/process/elasticproc/logsevents/logsAndEventsProcessor.go b/process/elasticproc/logsevents/logsAndEventsProcessor.go index e056ff17..8d358ef5 100644 --- a/process/elasticproc/logsevents/logsAndEventsProcessor.go +++ b/process/elasticproc/logsevents/logsAndEventsProcessor.go @@ -233,7 +233,7 @@ func (lep *logsAndEventsProcessor) prepareLogsForDB( continue } - ev := &data.Event{ + logEvent := &data.Event{ Address: lep.pubKeyConverter.SilentEncode(event.GetAddress(), log), Identifier: string(event.GetIdentifier()), Topics: event.GetTopics(), @@ -241,9 +241,9 @@ func (lep *logsAndEventsProcessor) prepareLogsForDB( AdditionalData: event.GetAdditionalData(), Order: idx, } - logsDB.Events = append(logsDB.Events, ev) + logsDB.Events = append(logsDB.Events, logEvent) - dbEvent, ok := lep.prepareLogEvent(logsDB, ev, shardID) + dbEvent, ok := lep.prepareLogEvent(logsDB, logEvent, shardID) if !ok { continue } diff --git a/process/elasticproc/logsevents/logsAndEventsProcessor_test.go b/process/elasticproc/logsevents/logsAndEventsProcessor_test.go index 279fb5c0..45551529 100644 --- a/process/elasticproc/logsevents/logsAndEventsProcessor_test.go +++ b/process/elasticproc/logsevents/logsAndEventsProcessor_test.go @@ -236,7 +236,7 @@ func TestLogsAndEventsProcessor_PrepareLogsForDB(t *testing.T) { }, }}, 1234, 0, 3) - logsDB, eventsDB := proc.PrepareLogsForDB(logsAndEvents, 1234, 0) + logsDB, _ := proc.PrepareLogsForDB(logsAndEvents, 1234, 0) require.Equal(t, &data.Logs{ ID: "747848617368", Address: "61646472657373", @@ -251,8 +251,6 @@ func TestLogsAndEventsProcessor_PrepareLogsForDB(t *testing.T) { }, }, }, logsDB[0]) - - _ = eventsDB } func TestLogsAndEventsProcessor_ExtractDataFromLogsNFTBurn(t *testing.T) {