Browse Source

redundant: you subscribed only to 'updated'

regtest_lnd
ThomasV 7 years ago
committed by SomberNight
parent
commit
96e87d34e0
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 25
      lib/lnbase.py

25
lib/lnbase.py

@ -797,20 +797,17 @@ class Peer(PrintError):
assert success assert success
# wait until we see confirmations # wait until we see confirmations
def on_network_update(event, *args): def on_network_update(event, *args):
if event == 'updated': conf = wallet.get_tx_height(funding_txid)[1]
conf = wallet.get_tx_height(funding_txid)[1] if conf >= funding_txn_minimum_depth:
if conf >= funding_txn_minimum_depth: async def set_local_funding_locked_result():
async def set_local_funding_locked_result(): try:
try: self.local_funding_locked[channel_id].set_result(1)
self.local_funding_locked[channel_id].set_result(1) except (asyncio.InvalidStateError, KeyError) as e:
except (asyncio.InvalidStateError, KeyError) as e: # FIXME race condition if updates come in quickly, set_result might be called multiple times
# FIXME race condition if updates come in quickly, set_result might be called multiple times # or self.local_funding_locked[channel_id] might be deleted already
# or self.local_funding_locked[channel_id] might be deleted already self.print_error('local_funding_locked.set_result error for channel {}: {}'.format(channel_id, e))
self.print_error('local_funding_locked.set_result error for channel {}: {}'.format(channel_id, e)) asyncio.run_coroutine_threadsafe(set_local_funding_locked_result(), asyncio.get_event_loop())
asyncio.run_coroutine_threadsafe(set_local_funding_locked_result(), asyncio.get_event_loop()) self.network.unregister_callback(on_network_update)
self.network.unregister_callback(on_network_update)
else:
self.print_error("unexpected network message:", event, args)
self.network.register_callback(on_network_update, ['updated']) # thread safe self.network.register_callback(on_network_update, ['updated']) # thread safe
try: try:

Loading…
Cancel
Save