Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
reliveyy committed Nov 3, 2020
1 parent be7f8a3 commit 218c403
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions images/utils/launcher/check_wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,27 @@ def ensure_layer2_ready(self) -> None:
print("Syncing light clients:")
self._print_lnd_cfheaders(erase_last_line=False)

with ThreadPoolExecutor(max_workers=len(self.lnd_cfheaders), thread_name_prefix="LndReady") as executor:
futs = {}
for chain in self.lnd_cfheaders:
futs[executor.submit(self.ensure_lnd_ready, chain)] = chain

done, not_done = wait(futs)

if len(not_done) > 0:
for f in not_done:
f.cancel()
lnds = ", ".join([futs[f] for f in not_done])
raise FatalError("Failed to wait for {} to be ready".format(lnds))
with ThreadPoolExecutor(max_workers=2, thread_name_prefix="LndReady") as executor:
native_lndbtc = self.config.nodes["lndbtc"]["mode"] == "native"
native_lndltc = self.config.nodes["lndltc"]["mode"] == "native"

if native_lndbtc:
f1 = executor.submit(self.ensure_lnd_ready, "bitcoin")

if native_lndltc:
f2 = executor.submit(self.ensure_lnd_ready, "litecoin")

if native_lndbtc:
try:
f1.result()
except Exception as e:
raise FatalError("Failed to wait for lndbtc to be ready") from e

if native_lndltc:
try:
f2.result()
except Exception as e:
raise FatalError("Failed to wait for lndltc to be ready") from e

if self.node_manager.newly_installed:
print()
Expand Down

0 comments on commit 218c403

Please sign in to comment.