Skip to content

Commit b508713

Browse files
committed
Better control logic for keyfile warning.
1 parent 8e8905c commit b508713

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lnutil/keyfile.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ func LoadKeyFromFileArg(filename string, pass []byte) (*[32]byte, error) {
6161

6262
if len(enckey) == 32 { // UNencrypted key, length 32
6363
v, p := os.LookupEnv("LIT_KEYFILE_WARN")
64-
if !p || v != "0" {
64+
if !p || (p && v != "0") {
6565
logging.Warnf("WARNING!! Key file not encrypted!!\n")
6666
logging.Warnf("Anyone who can read the key file can take everything!\n")
6767
logging.Warnf("You should start over and use a good passphrase!\n")
6868
}
69+
6970
copy(priv32[:], enckey[:])
7071
return priv32, nil
7172
}

test/testlib.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def start(self):
9797
"--noautolisten"
9898
]
9999
penv = os.environ.copy()
100-
penv['LIT_KEYFILE_WARN'] = '0'
100+
lkw = 'LIT_KEYFILE_WARN'
101+
if lkw not in penv:
102+
penv[lkw] = '0'
101103
self.proc = subprocess.Popen(args,
102104
stdin=subprocess.DEVNULL,
103105
stdout=outputredir,

0 commit comments

Comments
 (0)