Browse Source

rebase fixup: use new broadcast_transaction API

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
Janus 6 years ago
committed by ThomasV
parent
commit
94a10e6307
  1. 7
      electrum/gui/qt/channels_list.py
  2. 3
      electrum/lnbase.py
  3. 2
      electrum/lnchan.py
  4. 8
      electrum/lnwatcher.py

7
electrum/gui/qt/channels_list.py

@ -37,9 +37,10 @@ class ChannelsList(MyTreeWidget):
def close(): def close():
netw = self.parent.network netw = self.parent.network
coro = self.parent.wallet.lnworker.close_channel(channel_id) coro = self.parent.wallet.lnworker.close_channel(channel_id)
suc, msg = netw.run_from_another_thread(coro) try:
if not suc: _txid = netw.run_from_another_thread(coro)
self.main_window.show_error('Force-close failed:\n{}'.format(msg)) except Exception as e:
self.main_window.show_error('Force-close failed:\n{}'.format(repr(e)))
menu.addAction(_("Force-close channel"), close) menu.addAction(_("Force-close channel"), close)
menu.exec_(self.viewport().mapToGlobal(position)) menu.exec_(self.viewport().mapToGlobal(position))

3
electrum/lnbase.py

@ -655,8 +655,7 @@ class Peer(PrintError):
remote_sig = payload['signature'] remote_sig = payload['signature']
m.receive_new_commitment(remote_sig, []) m.receive_new_commitment(remote_sig, [])
# broadcast funding tx # broadcast funding tx
success, _txid = await self.network.broadcast_transaction(funding_tx) await self.network.broadcast_transaction(funding_tx)
assert success, success
m.remote_commitment_to_be_revoked = m.pending_remote_commitment m.remote_commitment_to_be_revoked = m.pending_remote_commitment
m.config[REMOTE] = m.config[REMOTE]._replace(ctn=0) m.config[REMOTE] = m.config[REMOTE]._replace(ctn=0)
m.config[LOCAL] = m.config[LOCAL]._replace(ctn=0, current_commitment_signature=remote_sig) m.config[LOCAL] = m.config[LOCAL]._replace(ctn=0, current_commitment_signature=remote_sig)

2
electrum/lnchan.py

@ -601,7 +601,7 @@ class Channel(PrintError):
return roundtripped return roundtripped
def __str__(self): def __str__(self):
return self.serialize() return str(self.serialize())
def make_commitment(self, subject, this_point) -> Transaction: def make_commitment(self, subject, this_point) -> Transaction:
remote_msat, local_msat = self.amounts() remote_msat, local_msat = self.amounts()

8
electrum/lnwatcher.py

@ -140,8 +140,12 @@ class LNWatcher(PrintError):
tx_height = self.addr_sync.get_tx_height(ctx_txid).height tx_height = self.addr_sync.get_tx_height(ctx_txid).height
num_conf = local_height - tx_height + 1 num_conf = local_height - tx_height + 1
if num_conf >= e_tx.csv_delay: if num_conf >= e_tx.csv_delay:
success, msg = await self.network.broadcast_transaction(e_tx.tx) try:
self.print_error('broadcast: {}, {}'.format('success' if success else 'failure', msg)) await self.network.broadcast_transaction(e_tx.tx)
except Exception as e:
self.print_error('broadcast: {}, {}'.format('failure', repr(e)))
else:
self.print_error('broadcast: {}'.format('success'))
else: else:
self.print_error('waiting for CSV ({} < {}) for funding outpoint {} and ctx {}' self.print_error('waiting for CSV ({} < {}) for funding outpoint {} and ctx {}'
.format(num_conf, e_tx.csv_delay, funding_outpoint, ctx.txid())) .format(num_conf, e_tx.csv_delay, funding_outpoint, ctx.txid()))

Loading…
Cancel
Save