Skip to content

Commit ec6dd2e

Browse files
committed
fix: empty if
1 parent 2c485ce commit ec6dd2e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

p2p/database/datastore.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,8 @@ func (d *Datastore) writeFirstSeen(newHeader *DatastoreHeader, block *DatastoreB
400400
newHeader.SensorFirstSeen = block.DatastoreHeader.SensorFirstSeen
401401
}
402402

403-
// Preserve earlier hash timing if it exists
404-
if !block.TimeFirstSeenHash.IsZero() && block.TimeFirstSeenHash.Before(tfs) {
405-
// Keep existing hash timing
406-
// (no need to reassign since we're reading and writing to the same block)
407-
} else {
408-
// Set new hash timing
403+
// Set hash timing if it doesn't exist or if new timestamp is earlier
404+
if block.TimeFirstSeenHash.IsZero() || tfs.Before(block.TimeFirstSeenHash) {
409405
block.TimeFirstSeenHash = tfs
410406
block.SensorFirstSeenHash = d.sensorID
411407
}

0 commit comments

Comments
 (0)