Browse Source

lnworker: move buckets logic inside first branch of if statement (refactoring commit)

patch-4
ThomasV 4 years ago
parent
commit
253907fb60
  1. 5
      electrum/lnworker.py

5
electrum/lnworker.py

@ -1378,6 +1378,7 @@ class LNWallet(LNWorker):
self.logger.info(f"trying split configuration: {s[0].values()} rating: {s[1]}")
routes = []
try:
if not self.channel_db:
buckets = defaultdict(list)
for chan_id, part_amount_msat in s[0].items():
chan = self.channels[chan_id]
@ -1385,7 +1386,6 @@ class LNWallet(LNWorker):
buckets[chan.node_id].append((chan_id, part_amount_msat))
for node_id, bucket in buckets.items():
bucket_amount_msat = sum([x[1] for x in bucket])
if not self.channel_db:
trampoline_onion, trampoline_fee, bucket_amount_with_fees, bucket_cltv_delta = create_trampoline_route_and_onion(
amount_msat=amount_msat,
bucket_amount_msat=bucket_amount_msat,
@ -1426,7 +1426,8 @@ class LNWallet(LNWorker):
self.logger.info('not enough margin to pay trampoline fee')
raise NoPathFound()
else:
for chan_id, part_amount_msat in bucket:
for chan_id, part_amount_msat in s[0].items():
if part_amount_msat:
channel = self.channels[chan_id]
route = self.create_route_for_payment(
amount_msat=part_amount_msat,

Loading…
Cancel
Save