mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
lnd+config: Move to FileExists function in lnrpc package
This commit is contained in:
@@ -210,7 +210,9 @@ func (t *TLSManager) generateOrRenewCert() (*tls.Config, func(), error) {
|
||||
// the encrypted form.
|
||||
func (t *TLSManager) generateCertPair(keyRing keychain.SecretKeyRing) error {
|
||||
// Ensure we create TLS key and certificate if they don't exist.
|
||||
if fileExists(t.cfg.TLSCertPath) || fileExists(t.cfg.TLSKeyPath) {
|
||||
if lnrpc.FileExists(t.cfg.TLSCertPath) ||
|
||||
lnrpc.FileExists(t.cfg.TLSKeyPath) {
|
||||
|
||||
// Handle discrepencies related to the TLSEncryptKey setting.
|
||||
return t.ensureEncryption(keyRing)
|
||||
}
|
||||
@@ -597,18 +599,6 @@ func (t *TLSManager) deleteEphemeralSettings() {
|
||||
t.ephemeralCertPath = ""
|
||||
}
|
||||
|
||||
// fileExists reports whether the named file or directory exists.
|
||||
// This function is taken from https://github.com/btcsuite/btcd
|
||||
func fileExists(name string) bool {
|
||||
if _, err := os.Stat(name); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCertExpired checks if the current TLS certificate is expired.
|
||||
func (t *TLSManager) IsCertExpired(keyRing keychain.SecretKeyRing) (bool,
|
||||
time.Time, error) {
|
||||
|
Reference in New Issue
Block a user