mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-15 17:02:06 +01:00
Only keep most recent signatures for datum in CertificationSet
This commit is contained in:
parent
73708f4a6f
commit
85b5624499
1 changed files with 13 additions and 1 deletions
|
@ -77,6 +77,7 @@ class CertificationSet(
|
|||
|
||||
/**
|
||||
* Add a single [Certification] into this objects [certifications].
|
||||
* If there are already some [Cer]
|
||||
*
|
||||
* @param certification [Certification] with the same issuer fingerprint and target fingerprint as this object.
|
||||
*/
|
||||
|
@ -89,7 +90,18 @@ class CertificationSet(
|
|||
certificationsForUserId = ArrayList()
|
||||
_certifications[certification.userId] = certificationsForUserId
|
||||
}
|
||||
|
||||
if (certificationsForUserId.isEmpty()) {
|
||||
certificationsForUserId.add(certification)
|
||||
return
|
||||
}
|
||||
|
||||
val existing = certificationsForUserId[0]
|
||||
if (existing.creationTime.before(certification.creationTime)) {
|
||||
certificationsForUserId.clear() // throw away older certifications
|
||||
certificationsForUserId.add(certification)
|
||||
}
|
||||
// else this certification is older, so ignore
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
|
Loading…
Reference in a new issue