Skip to content

Commit

Permalink
Save seconds instead of ms for block timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Dec 9, 2024
1 parent 9491ea8 commit 4a8fc58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions backup/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestBackup_ExecuteBackup_FixedRange(t *testing.T) {

return &client.Block{
Height: blockNum,
Timestamp: blockTime.Add(time.Duration(blockNum) * time.Minute).UnixMilli(),
Timestamp: blockTime.Add(time.Duration(blockNum) * time.Minute).Unix(),
Txs: []std.Tx{exampleTx},
}, nil // 1 tx per block
},
Expand Down Expand Up @@ -161,8 +161,8 @@ func TestBackup_ExecuteBackup_FixedRange(t *testing.T) {
assert.Equal(t, exampleTx, txData.Tx)
assert.Equal(
t,
blockTime.Add(time.Duration(expectedBlock)*time.Minute).Local(),
time.UnixMilli(txData.Metadata.Timestamp),
blockTime.Add(time.Duration(expectedBlock)*time.Minute).Unix(),
txData.Metadata.Timestamp,
)

expectedBlock++
Expand Down Expand Up @@ -214,7 +214,7 @@ func TestBackup_ExecuteBackup_Watch(t *testing.T) {

return &client.Block{
Height: blockNum,
Timestamp: blockTime.Add(time.Duration(blockNum) * time.Minute).UnixMilli(),
Timestamp: blockTime.Add(time.Duration(blockNum) * time.Minute).Unix(),
Txs: []std.Tx{exampleTx},
}, nil // 1 tx per block
},
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestBackup_ExecuteBackup_Watch(t *testing.T) {
assert.Equal(
t,
blockTime.Add(time.Duration(expectedBlock)*time.Minute).Local(),
time.UnixMilli(txData.Metadata.Timestamp),
time.Unix(txData.Metadata.Timestamp, 0),
)

expectedBlock++
Expand Down
2 changes: 1 addition & 1 deletion backup/client/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *Client) GetBlock(blockNum uint64) (*client.Block, error) {
}

return &client.Block{
Timestamp: block.Block.Time.UnixMilli(),
Timestamp: block.Block.Time.Unix(),
Height: blockNum,
Txs: txs,
}, nil
Expand Down

0 comments on commit 4a8fc58

Please sign in to comment.