Skip to content

Commit

Permalink
change marshaller
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Mar 7, 2024
1 parent 30ee12b commit 4c7756a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions process/elasticproc/logsevents/logsAndEventsProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package logsevents

import (
"encoding/hex"
"encoding/json"
"time"

"github.com/multiversx/mx-chain-core-go/core"
Expand Down Expand Up @@ -266,19 +267,18 @@ func (lep *logsAndEventsProcessor) prepareLogEvent(dbLog *data.Logs, event *data
ShardID: shardID,
}

eventHash, err := core.CalculateHash(lep.marshaller, lep.hasher, dbEvent)
dbEventBytes, err := json.Marshal(dbEvent)
if err != nil {
log.Warn("cannot compute hash of event",
log.Warn("cannot marshal event",
"txHash", dbLog.ID,
"order", event.Order,
"error", err,
)
return nil, false
}

dbEvent.OriginalTxHash = dbLog.OriginalTxHash
dbEvent.Timestamp = dbLog.Timestamp
dbEvent.ID = hex.EncodeToString(eventHash)
dbEvent.ID = hex.EncodeToString(lep.hasher.Compute(string(dbEventBytes)))

return dbEvent, true
}
Expand Down

0 comments on commit 4c7756a

Please sign in to comment.