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

This commit is contained in:
Thiago Romão Barcala authored and Mohamed Awnallah committed 2025-11-27 13:33:14 +00:00
1 parent c9dea6d621
commit c7fe6425f3
1 file changed
+2 -2
+2 -2
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 // is already written to disk, this function overwrites the plaintext key with
// the encrypted form. // the encrypted form.
func (t *TLSManager) generateCertPair(keyRing keychain.SecretKeyRing) error { func (t *TLSManager) generateCertPair(keyRing keychain.SecretKeyRing) error {
// Ensure we create TLS key and certificate if they don't exist. // Ensure we create TLS key and certificate if they don't both exist.
if lnrpc.FileExists(t.cfg.TLSCertPath) || if lnrpc.FileExists(t.cfg.TLSCertPath) &&
lnrpc.FileExists(t.cfg.TLSKeyPath) { lnrpc.FileExists(t.cfg.TLSKeyPath) {
// Handle discrepencies related to the TLSEncryptKey setting. // Handle discrepencies related to the TLSEncryptKey setting.