Skip to content

Commit 12aeb44

Browse files
authored
Merge pull request #730 from pinheadmz/ln-addr-wait
ln_init: wait for LN node readiness when getting wallet address
2 parents 98d5f97 + 1abae89 commit 12aeb44

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

resources/scenarios/ln_init.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@ def gen(n):
4242
ln_addrs = []
4343

4444
def get_ln_addr(self, ln):
45-
success, address = ln.newaddress()
46-
if success:
47-
ln_addrs.append(address)
48-
self.log.info(f"Got wallet address {address} from {ln.name}")
49-
else:
50-
self.log.info(f"Couldn't get wallet address from {ln.name}")
45+
address = None
46+
while True:
47+
success, address = ln.newaddress()
48+
if success:
49+
ln_addrs.append(address)
50+
self.log.info(f"Got wallet address {address} from {ln.name}")
51+
break
52+
else:
53+
self.log.info(
54+
f"Couldn't get wallet address from {ln.name}, retrying in 5 seconds..."
55+
)
56+
sleep(5)
5157

5258
addr_threads = [
5359
threading.Thread(target=get_ln_addr, args=(self, ln)) for ln in self.lns.values()

0 commit comments

Comments
 (0)