Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Jan 10, 2024
2 parents 867947f + df1b9a2 commit 3bbebc7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 38 deletions.
2 changes: 1 addition & 1 deletion electrum_grs/gui/qml/qetxdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def update(self, from_txid: bool = False):

if from_txid:
self._tx = self._wallet.wallet.db.get_transaction(self._txid)
assert self._tx is not None
assert self._tx is not None, f'unknown txid "{self._txid}"'

#self._logger.debug(repr(self._tx.to_json()))

Expand Down
3 changes: 2 additions & 1 deletion electrum_grs/lnworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ async def cb(reader, writer):
except OSError as e:
self.logger.error(f"cannot listen for lightning p2p. error: {e!r}")

@ignore_exceptions # don't kill outer taskgroup
async def main_loop(self):
self.logger.info("starting taskgroup.")
try:
Expand Down Expand Up @@ -937,6 +936,8 @@ async def stop(self):
if self.lnwatcher:
await self.lnwatcher.stop()
self.lnwatcher = None
if self.swap_manager: # may not be present in tests
await self.swap_manager.stop()

async def wait_for_received_pending_htlcs_to_get_removed(self):
assert self.stopping_soon is True
Expand Down
31 changes: 0 additions & 31 deletions electrum_grs/plugins/swapserver/qt.py

This file was deleted.

2 changes: 0 additions & 2 deletions electrum_grs/plugins/trustedcoin/trustedcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,6 @@ def add_new_billing_address(self, billing_index: int, address: str, addr_type: s
self._billing_addresses[addr_type] = billing_addresses_of_this_type
self.db.put('trustedcoin_billing_addresses', self._billing_addresses['legacy'])
self.db.put('trustedcoin_billing_addresses_segwit', self._billing_addresses['segwit'])
# FIXME this often runs in a daemon thread, where storage.write will fail
self.db.write()

def is_billing_address(self, addr: str) -> bool:
return addr in self._billing_addresses_set
Expand Down
16 changes: 14 additions & 2 deletions electrum_grs/submarine_swaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,20 @@ def start_network(self, *, network: 'Network', lnwatcher: 'LNWalletWatcher'):
self.add_lnwatcher_callback(swap)

self.taskgroup = OldTaskGroup()
coro = self.pay_pending_invoices()
asyncio.run_coroutine_threadsafe(self.taskgroup.spawn(coro), self.network.asyncio_loop)
asyncio.run_coroutine_threadsafe(self.main_loop(), self.network.asyncio_loop)

async def main_loop(self):
self.logger.info("starting taskgroup.")
try:
async with self.taskgroup as group:
await group.spawn(self.pay_pending_invoices())
except Exception as e:
self.logger.exception("taskgroup died.")
finally:
self.logger.info("taskgroup stopped.")

async def stop(self):
await self.taskgroup.cancel_remaining()

async def pay_invoice(self, key):
self.logger.info(f'trying to pay invoice {key}')
Expand Down
1 change: 1 addition & 0 deletions electrum_grs/tests/test_lnpeer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def __init__(self, *, local_keypair: Keypair, chans: Iterable['Channel'], tx_que
self.network = MockNetwork(tx_queue, config=self.config)
self.taskgroup = OldTaskGroup()
self.lnwatcher = None
self.swap_manager = None
self.listen_server = None
self._channels = {chan.channel_id: chan for chan in chans}
self.payment_info = {}
Expand Down
1 change: 0 additions & 1 deletion electrum_grs/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ def __init__(self, db: WalletDB, *, config: SimpleConfig):
def _init_lnworker(self):
self.lnworker = None

@ignore_exceptions # don't kill outer taskgroup
async def main_loop(self):
self.logger.info("starting taskgroup.")
try:
Expand Down

0 comments on commit 3bbebc7

Please sign in to comment.