electrum

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

commit 94a10e6307c25499f4fd556987f8d4d0c2e14b53
parent 601356f5d166ce6798fda5d040bb088c85b8e77d
Author: Janus <ysangkok@gmail.com>
Date:   Fri, 12 Oct 2018 16:27:12 +0200

rebase fixup: use new broadcast_transaction API

Diffstat:
Melectrum/gui/qt/channels_list.py | 7++++---
Melectrum/lnbase.py | 3+--
Melectrum/lnchan.py | 2+-
Melectrum/lnwatcher.py | 8++++++--
4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py @@ -37,9 +37,10 @@ class ChannelsList(MyTreeWidget): def close(): netw = self.parent.network coro = self.parent.wallet.lnworker.close_channel(channel_id) - suc, msg = netw.run_from_another_thread(coro) - if not suc: - self.main_window.show_error('Force-close failed:\n{}'.format(msg)) + try: + _txid = netw.run_from_another_thread(coro) + except Exception as e: + self.main_window.show_error('Force-close failed:\n{}'.format(repr(e))) menu.addAction(_("Force-close channel"), close) menu.exec_(self.viewport().mapToGlobal(position)) diff --git a/electrum/lnbase.py b/electrum/lnbase.py @@ -655,8 +655,7 @@ class Peer(PrintError): remote_sig = payload['signature'] m.receive_new_commitment(remote_sig, []) # broadcast funding tx - success, _txid = await self.network.broadcast_transaction(funding_tx) - assert success, success + await self.network.broadcast_transaction(funding_tx) m.remote_commitment_to_be_revoked = m.pending_remote_commitment m.config[REMOTE] = m.config[REMOTE]._replace(ctn=0) m.config[LOCAL] = m.config[LOCAL]._replace(ctn=0, current_commitment_signature=remote_sig) diff --git a/electrum/lnchan.py b/electrum/lnchan.py @@ -601,7 +601,7 @@ class Channel(PrintError): return roundtripped def __str__(self): - return self.serialize() + return str(self.serialize()) def make_commitment(self, subject, this_point) -> Transaction: remote_msat, local_msat = self.amounts() diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py @@ -140,8 +140,12 @@ class LNWatcher(PrintError): tx_height = self.addr_sync.get_tx_height(ctx_txid).height num_conf = local_height - tx_height + 1 if num_conf >= e_tx.csv_delay: - success, msg = await self.network.broadcast_transaction(e_tx.tx) - self.print_error('broadcast: {}, {}'.format('success' if success else 'failure', msg)) + try: + 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: self.print_error('waiting for CSV ({} < {}) for funding outpoint {} and ctx {}' .format(num_conf, e_tx.csv_delay, funding_outpoint, ctx.txid()))