mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 01:52:26 +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 {
|
if r == nil || r.GetSequence() < bestSeq {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if besti == -1 || r.GetSequence() > bestSeq {
|
|
||||||
bestSeq = r.GetSequence()
|
|
||||||
besti = i
|
|
||||||
} else if r.GetSequence() == bestSeq {
|
|
||||||
rt, err := u.ParseRFC3339(string(r.GetValidity()))
|
rt, err := u.ParseRFC3339(string(r.GetValidity()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failed to parse ipns record EOL %s", r.GetValidity())
|
log.Errorf("failed to parse ipns record EOL %s", r.GetValidity())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
bestt, err := u.ParseRFC3339(string(recs[besti].GetValidity()))
|
if besti == -1 || r.GetSequence() > bestSeq {
|
||||||
if err != nil {
|
bestSeq = r.GetSequence()
|
||||||
log.Errorf("failed to parse ipns record EOL %s", recs[besti].GetValidity())
|
besti = i
|
||||||
continue
|
} else if r.GetSequence() == bestSeq {
|
||||||
}
|
bestt, _ := u.ParseRFC3339(string(recs[besti].GetValidity()))
|
||||||
|
|
||||||
if rt.After(bestt) {
|
if rt.After(bestt) {
|
||||||
besti = i
|
besti = i
|
||||||
} else if rt == bestt {
|
} else if rt == bestt {
|
||||||
|
Reference in New Issue
Block a user