diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index 281f6352329938c99057917b61243963f2a693d0..2a262089c5a0ed07284e27652240d6dc6c819e0f 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -1391,14 +1391,12 @@ RingAccount::updateCertificates(ArchiveContent& archive, dht::crypto::Identity& // Currently set the CA flag and update expiration dates bool updated = false; - // Update CA if possible and relevant auto& cert = archive.id.second; auto ca = cert->issuer; - if (ca and not ca->issuer) { - if (not ca->isCA() or ca->getExpiration() < clock::now()) { - ca = std::make_shared<Certificate>(Certificate::generate(*archive.ca_key, "Ring CA", {}, true)); - updated = true; - } + // Update CA if possible and relevant + if (not ca or (not ca->issuer and (not ca->isCA() or ca->getExpiration() < clock::now()))) { + ca = std::make_shared<Certificate>(Certificate::generate(*archive.ca_key, "Ring CA", {}, true)); + updated = true; } // Update certificate