Fix for int64 pointer bug
This commit is contained in:
parent
ba559c5291
commit
b3187abce1
|
@ -604,7 +604,7 @@ func (m *Messenger) shouldPublishChatIdentity(chatID string) (bool, error) {
|
|||
return true, nil
|
||||
}
|
||||
|
||||
return *lp == 0 || time.Now().Unix()-*lp > 24*60*60, nil
|
||||
return lp == 0 || time.Now().Unix()-lp > 24*60*60, nil
|
||||
}
|
||||
|
||||
// createChatIdentity creates a context based protobuf.ChatIdentity.
|
||||
|
|
|
@ -856,19 +856,19 @@ func (db sqlitePersistence) TransactionsToValidate() ([]*TransactionToValidate,
|
|||
return transactions, nil
|
||||
}
|
||||
|
||||
func (db sqlitePersistence) GetWhenChatIdentityLastPublished(chatID string) (t *int64, hash []byte, err error) {
|
||||
func (db sqlitePersistence) GetWhenChatIdentityLastPublished(chatID string) (t int64, hash []byte, err error) {
|
||||
rows, err := db.db.Query("SELECT clock_value, hash FROM chat_identity_last_published WHERE chat_id = ?", chatID)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return t, nil, err
|
||||
}
|
||||
defer func() {
|
||||
err = rows.Close()
|
||||
}()
|
||||
|
||||
for rows.Next() {
|
||||
err = rows.Scan(t, &hash)
|
||||
err = rows.Scan(&t, &hash)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return t, nil, err
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -659,7 +659,7 @@ func TestSqlitePersistence_GetWhenChatIdentityLastPublished(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// Check that the save happened in the last 2 seconds
|
||||
diff := *ts - now
|
||||
diff := ts - now
|
||||
require.LessOrEqual(t, diff, int64(2))
|
||||
|
||||
require.True(t, bytes.Equal(hash, actualHash))
|
||||
|
@ -667,7 +667,7 @@ func TestSqlitePersistence_GetWhenChatIdentityLastPublished(t *testing.T) {
|
|||
// Require unsaved values to be zero
|
||||
ts2, actualHash2, err := p.GetWhenChatIdentityLastPublished("0xdeadbeef")
|
||||
require.NoError(t, err)
|
||||
require.Exactly(t, int64(0), *ts2)
|
||||
require.Exactly(t, int64(0), ts2)
|
||||
require.Nil(t, actualHash2)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue