tls_manager.go: handle case when either TLS pair files exist

This commit is contained in:
Thiago Romão Barcala 2025-11-27 13:18:15 +00:00 committed by Mohamed Awnallah
parent c9dea6d621
commit c7fe6425f3

View file

@ -208,8 +208,8 @@ func (t *TLSManager) generateOrRenewCert() (*tls.Config, error) {
// is already written to disk, this function overwrites the plaintext key with
// the encrypted form.
func (t *TLSManager) generateCertPair(keyRing keychain.SecretKeyRing) error {
// Ensure we create TLS key and certificate if they don't exist.
if lnrpc.FileExists(t.cfg.TLSCertPath) ||
// Ensure we create TLS key and certificate if they don't both exist.
if lnrpc.FileExists(t.cfg.TLSCertPath) &&
lnrpc.FileExists(t.cfg.TLSKeyPath) {
// Handle discrepencies related to the TLSEncryptKey setting.