From ed38bf58fd41bc3380321590b502f86d36b8aa56 Mon Sep 17 00:00:00 2001 From: miiu Date: Mon, 8 Apr 2024 10:23:03 +0300 Subject: [PATCH] fixes after second review --- data/transaction.go | 4 ++-- .../testdata/logsCrossShard/event-transfer-source-first.json | 2 +- process/elasticproc/logsevents/logsAndEventsProcessor.go | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/data/transaction.go b/data/transaction.go index 89bf800e..6d1b784b 100644 --- a/data/transaction.go +++ b/data/transaction.go @@ -6,8 +6,8 @@ import ( // Transaction is a structure containing all the fields that need // -// to be saved for a transaction. It has all the default fields -// plus some extra information for ease of search and filter +// to be saved for a transaction. It has all the default fields +// plus some extra information for ease of search and filter type Transaction struct { MBHash string `json:"miniBlockHash"` Nonce uint64 `json:"nonce"` diff --git a/integrationtests/testdata/logsCrossShard/event-transfer-source-first.json b/integrationtests/testdata/logsCrossShard/event-transfer-source-first.json index 1551fcfb..d085f338 100644 --- a/integrationtests/testdata/logsCrossShard/event-transfer-source-first.json +++ b/integrationtests/testdata/logsCrossShard/event-transfer-source-first.json @@ -12,4 +12,4 @@ "txHash": "63726f73732d6c6f67", "order": 0, "timestamp": 5040 -} \ No newline at end of file +} diff --git a/process/elasticproc/logsevents/logsAndEventsProcessor.go b/process/elasticproc/logsevents/logsAndEventsProcessor.go index bdbc0499..ee4ab074 100644 --- a/process/elasticproc/logsevents/logsAndEventsProcessor.go +++ b/process/elasticproc/logsevents/logsAndEventsProcessor.go @@ -16,6 +16,8 @@ import ( "github.com/multiversx/mx-chain-es-indexer-go/process/dataindexer" ) +const eventIDFormat = "%s-%d-%d" + // ArgsLogsAndEventsProcessor holds all dependencies required to create new instances of logsAndEventsProcessor type ArgsLogsAndEventsProcessor struct { PubKeyConverter core.PubkeyConverter @@ -263,7 +265,7 @@ func (lep *logsAndEventsProcessor) prepareLogEvent(dbLog *data.Logs, event *data TxOrder: execOrder, OriginalTxHash: dbLog.OriginalTxHash, Timestamp: dbLog.Timestamp, - ID: fmt.Sprintf("%s-%d-%d", dbLog.ID, shardID, event.Order), + ID: fmt.Sprintf(eventIDFormat, dbLog.ID, shardID, event.Order), } return dbEvent