electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit f1d067f4464f29426f57d47bc9fe550448b31fac
parent aeb58dbd66d79315e6843f77dfe5e4a78d4500c6
Author: ThomasV <thomasv@electrum.org>
Date:   Wed,  6 Jun 2018 20:30:29 +0200

revert the introduction of add_invoice_coroutine in a612c2b09

Diffstat:
Mlib/lnworker.py | 11+----------
1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/lib/lnworker.py b/lib/lnworker.py @@ -197,17 +197,8 @@ class LNWorker(PrintError): coro = peer.pay(path, chan, amount_msat, payment_hash, invoice_pubkey, addr.min_final_cltv_expiry) asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop) - def add_invoice(self, amount_sat, message='one cup of coffee'): - coro = self._add_invoice_coroutine(amount_sat, message) - return asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop).result() - - async def _add_invoice_coroutine(self, amount_sat, message): + def add_invoice(self, amount_sat, message): is_open = lambda chan: self.channel_state[chan.channel_id] == "OPEN" - # TODO doesn't account for fees!!! - if not any(openchannel.remote_state.amount_msat >= amount_sat * 1000 for openchannel in self.channels.values() if is_open(openchannel)): - return "Not making invoice, no channel has enough balance" - if not any(openchannel.remote_config.max_htlc_value_in_flight_msat >= amount_sat * 1000 for openchannel in self.channels.values() if is_open(openchannel)): - return "Not making invoice, invoice value too lang for remote peer" payment_preimage = os.urandom(32) RHASH = sha256(payment_preimage) pay_req = lnencode(LnAddr(RHASH, amount_sat/Decimal(COIN), tags=[('d', message)]), self.privkey)