mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
namesys: discard records with invalid EOL in record selection
License: MIT Signed-off-by: Dirk McCormick <dirkmdev@gmail.com>
This commit is contained in:
@ -35,23 +35,17 @@ func selectRecord(recs []*pb.IpnsEntry, vals [][]byte) (int, error) {
|
||||
if r == nil || r.GetSequence() < bestSeq {
|
||||
continue
|
||||
}
|
||||
rt, err := u.ParseRFC3339(string(r.GetValidity()))
|
||||
if err != nil {
|
||||
log.Errorf("failed to parse ipns record EOL %s", r.GetValidity())
|
||||
continue
|
||||
}
|
||||
|
||||
if besti == -1 || r.GetSequence() > bestSeq {
|
||||
bestSeq = r.GetSequence()
|
||||
besti = i
|
||||
} else if r.GetSequence() == bestSeq {
|
||||
rt, err := u.ParseRFC3339(string(r.GetValidity()))
|
||||
if err != nil {
|
||||
log.Errorf("failed to parse ipns record EOL %s", r.GetValidity())
|
||||
continue
|
||||
}
|
||||
|
||||
bestt, err := u.ParseRFC3339(string(recs[besti].GetValidity()))
|
||||
if err != nil {
|
||||
log.Errorf("failed to parse ipns record EOL %s", recs[besti].GetValidity())
|
||||
continue
|
||||
}
|
||||
|
||||
bestt, _ := u.ParseRFC3339(string(recs[besti].GetValidity()))
|
||||
if rt.After(bestt) {
|
||||
besti = i
|
||||
} else if rt == bestt {
|
||||
|
Reference in New Issue
Block a user