Browse Source

lnworker: fix maybe_raise_trampoline_level.

That function was a no-op due to wrong indentation level
patch-4
ThomasV 2 years ago
parent
commit
2c57a8c394
  1. 16
      electrum/lnworker.py

16
electrum/lnworker.py

@ -1224,8 +1224,7 @@ class LNWallet(LNWorker):
# sometimes need to fall back to a single trampoline forwarder, at the expense # sometimes need to fall back to a single trampoline forwarder, at the expense
# of privacy # of privacy
use_two_trampolines = True use_two_trampolines = True
self.trampoline_fee_level = self.INITIAL_TRAMPOLINE_FEE_LEVEL
trampoline_fee_level = self.INITIAL_TRAMPOLINE_FEE_LEVEL
start_time = time.time() start_time = time.time()
amount_inflight = 0 # what we sent in htlcs (that receiver gets, without fees) amount_inflight = 0 # what we sent in htlcs (that receiver gets, without fees)
while True: while True:
@ -1244,7 +1243,7 @@ class LNWallet(LNWorker):
full_path=full_path, full_path=full_path,
payment_hash=payment_hash, payment_hash=payment_hash,
payment_secret=payment_secret, payment_secret=payment_secret,
trampoline_fee_level=trampoline_fee_level, trampoline_fee_level=self.trampoline_fee_level,
use_two_trampolines=use_two_trampolines, use_two_trampolines=use_two_trampolines,
fwd_trampoline_onion=fwd_trampoline_onion, fwd_trampoline_onion=fwd_trampoline_onion,
channels=channels, channels=channels,
@ -1263,7 +1262,7 @@ class LNWallet(LNWorker):
payment_secret=bucket_payment_secret, payment_secret=bucket_payment_secret,
min_cltv_expiry=cltv_delta, min_cltv_expiry=cltv_delta,
trampoline_onion=trampoline_onion, trampoline_onion=trampoline_onion,
trampoline_fee_level=trampoline_fee_level) trampoline_fee_level=self.trampoline_fee_level)
util.trigger_callback('invoice_status', self.wallet, payment_hash.hex()) util.trigger_callback('invoice_status', self.wallet, payment_hash.hex())
# 3. await a queue # 3. await a queue
self.logger.info(f"amount inflight {amount_inflight}") self.logger.info(f"amount inflight {amount_inflight}")
@ -1300,12 +1299,11 @@ class LNWallet(LNWorker):
# trampoline # trampoline
if not self.channel_db: if not self.channel_db:
def maybe_raise_trampoline_fee(htlc_log): def maybe_raise_trampoline_fee(htlc_log):
global trampoline_fee_level if htlc_log.trampoline_fee_level == self.trampoline_fee_level:
if htlc_log.trampoline_fee_level == trampoline_fee_level: self.trampoline_fee_level += 1
trampoline_fee_level += 1 self.logger.info(f'raising trampoline fee level {self.trampoline_fee_level}')
self.logger.info(f'raising trampoline fee level {trampoline_fee_level}')
else: else:
self.logger.info(f'NOT raising trampoline fee level, already at {trampoline_fee_level}') self.logger.info(f'NOT raising trampoline fee level, already at {self.trampoline_fee_level}')
# FIXME The trampoline nodes in the path are chosen randomly. # FIXME The trampoline nodes in the path are chosen randomly.
# Some of the errors might depend on how we have chosen them. # Some of the errors might depend on how we have chosen them.
# Having more attempts is currently useful in part because of the randomness, # Having more attempts is currently useful in part because of the randomness,

Loading…
Cancel
Save