ThomasV 5 years ago
parent
commit
e936b6e4a5
  1. 21
      electrum/lnworker.py

21
electrum/lnworker.py

@ -1953,22 +1953,21 @@ class LNWallet(LNWorker):
return Decimal(can_send_minus_fees) / 1000 return Decimal(can_send_minus_fees) / 1000
def num_sats_can_receive(self) -> Decimal: def num_sats_can_receive(self) -> Decimal:
can_receive = 0
with self.lock: with self.lock:
if self.channels: channels = [
for c in self.channels.values(): c for c in self.channels.values()
if c.is_active() and not c.is_frozen_for_receiving(): if c.is_active() and not c.is_frozen_for_receiving()
can_receive += c.available_to_spend(REMOTE) ]
can_receive = sum([c.available_to_spend(REMOTE) for c in channels]) if channels else 0
return Decimal(can_receive) / 1000 return Decimal(can_receive) / 1000
def num_sats_can_receive_no_mpp(self) -> Decimal: def num_sats_can_receive_no_mpp(self) -> Decimal:
can_receive = 0
with self.lock: with self.lock:
if self.channels: channels = [
can_receive = max([ c for c in self.channels.values()
c.available_to_spend(REMOTE) for c in self.channels.values() if c.is_active() and not c.is_frozen_for_receiving()
if c.is_active() and not c.is_frozen_for_receiving() ]
]) can_receive = max([c.available_to_spend(REMOTE) for c in channels]) if channels else 0
return Decimal(can_receive) / 1000 return Decimal(can_receive) / 1000
def can_pay_invoice(self, invoice: LNInvoice) -> bool: def can_pay_invoice(self, invoice: LNInvoice) -> bool:

Loading…
Cancel
Save