Skip to content

Commit f4cb56b

Browse files
committed
fix
1 parent 1889119 commit f4cb56b

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

data/transaction.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package data
22

3-
import (
4-
"time"
5-
)
6-
73
// Transaction is a structure containing all the fields that need
84
// to be saved for a transaction. It has all the default fields
95
// plus some extra information for ease of search and filter
@@ -62,13 +58,13 @@ type Transaction struct {
6258

6359
// Receipt is a structure containing all the fields that need to be safe for a Receipt
6460
type Receipt struct {
65-
Hash string `json:"-"`
66-
Value string `json:"value"`
67-
Sender string `json:"sender"`
68-
Data string `json:"data,omitempty"`
69-
TxHash string `json:"txHash"`
70-
Timestamp time.Duration `json:"timestamp"`
71-
TimestampMs time.Duration `json:"timestampMs,omitempty"`
61+
Hash string `json:"-"`
62+
Value string `json:"value"`
63+
Sender string `json:"sender"`
64+
Data string `json:"data,omitempty"`
65+
TxHash string `json:"txHash"`
66+
Timestamp uint64 `json:"timestamp"`
67+
TimestampMs uint64 `json:"timestampMs,omitempty"`
7268
}
7369

7470
// PreparedResults is the DTO that holds all the results after processing

process/elasticproc/transactions/transactionDBBuilder.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package transactions
33
import (
44
"encoding/hex"
55
"fmt"
6-
"time"
7-
86
"github.com/multiversx/mx-chain-core-go/core"
97
"github.com/multiversx/mx-chain-core-go/core/sharding"
108
coreData "github.com/multiversx/mx-chain-core-go/data"
@@ -201,7 +199,7 @@ func (dtb *dbTransactionBuilder) prepareReceipt(
201199
Sender: senderAddr,
202200
Data: string(rec.Data),
203201
TxHash: hex.EncodeToString(rec.TxHash),
204-
Timestamp: time.Duration(header.GetTimeStamp()),
205-
TimestampMs: time.Duration(timestampMs),
202+
Timestamp: header.GetTimeStamp(),
203+
TimestampMs: timestampMs,
206204
}
207205
}

process/elasticproc/transactions/transactionsGrouper_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ package transactions
22

33
import (
44
"encoding/hex"
5-
"testing"
6-
"time"
7-
85
"github.com/multiversx/mx-chain-core-go/data/block"
96
"github.com/multiversx/mx-chain-core-go/data/outport"
107
"github.com/multiversx/mx-chain-core-go/data/receipt"
@@ -13,6 +10,7 @@ import (
1310
"github.com/multiversx/mx-chain-es-indexer-go/mock"
1411
"github.com/multiversx/mx-chain-es-indexer-go/process/elasticproc/converters"
1512
"github.com/stretchr/testify/require"
13+
"testing"
1614
)
1715

1816
func TestGroupNormalTxs(t *testing.T) {
@@ -139,6 +137,6 @@ func TestGroupReceipts(t *testing.T) {
139137

140138
receipts := grouper.groupReceipts(header, txs, 1234000)
141139
require.Len(t, receipts, 2)
142-
require.Equal(t, time.Duration(1234), receipts[0].Timestamp)
143-
require.Equal(t, time.Duration(1234000), receipts[0].TimestampMs)
140+
require.Equal(t, uint64(1234), receipts[0].Timestamp)
141+
require.Equal(t, uint64(1234000), receipts[0].TimestampMs)
144142
}

0 commit comments

Comments
 (0)