Skip to content
Snippets Groups Projects
Commit 8041f9d9 authored by Jonah Husson's avatar Jonah Husson
Browse files

InsertFactTwilio should update columns on conflict

parent 7fc64d3d
No related branches found
No related tags found
4 merge requests!50Revert "update deps",!48Release,!43InsertFactTwilio should update columns on conflict,!42Add username field to users table for raw username
......@@ -92,9 +92,12 @@ func (db *DatabaseImpl) InsertFactTwilio(userID, factHash, signature []byte, fac
}
tf := func(tx *gorm.DB) error {
// TODO: THIS IS A RACE CONDITION
// currently, unverified facts can be overwritten. When registerFact (io/factRegistration.go) is called,
// it searches for VERIFIED facts with the hash on line 53. This means that unverified facts can compete with each other
return tx.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "hash"}},
DoUpdates: clause.AssignmentColumns([]string{"timestamp"}),
UpdateAll: true,
}).Create(f).Error
}
......
......@@ -35,8 +35,8 @@ func (m *Manager) RegisterFact(uid *id.ID, fact string, factType uint8, signatur
} else {
to = fact
channel = Email.String()
}
verifyId, err := m.verifier.Verification(to, channel)
jww.INFO.Printf("Sent verification & received %s", verifyId)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment