mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
Qt gui: show messages about payment outcome
This commit is contained in:
parent
784b4a9d65
commit
dd957e1836
2 changed files with 9 additions and 2 deletions
|
@ -208,7 +208,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
interests = ['wallet_updated', 'network_updated', 'blockchain_updated',
|
interests = ['wallet_updated', 'network_updated', 'blockchain_updated',
|
||||||
'new_transaction', 'status',
|
'new_transaction', 'status',
|
||||||
'banner', 'verified', 'fee', 'fee_histogram', 'on_quotes',
|
'banner', 'verified', 'fee', 'fee_histogram', 'on_quotes',
|
||||||
'on_history', 'channel', 'channels', 'ln_status']
|
'on_history', 'channel', 'channels', 'ln_status', 'ln_message']
|
||||||
# To avoid leaking references to "self" that prevent the
|
# To avoid leaking references to "self" that prevent the
|
||||||
# window from being GC-ed when closed, callbacks should be
|
# window from being GC-ed when closed, callbacks should be
|
||||||
# methods of this class only, and specifically not be
|
# methods of this class only, and specifically not be
|
||||||
|
@ -321,7 +321,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
wallet, tx = args
|
wallet, tx = args
|
||||||
if wallet == self.wallet:
|
if wallet == self.wallet:
|
||||||
self.tx_notification_queue.put(tx)
|
self.tx_notification_queue.put(tx)
|
||||||
elif event in ['status', 'banner', 'verified', 'fee', 'fee_histogram']:
|
elif event in ['status', 'banner', 'verified', 'fee', 'fee_histogram', 'ln_message']:
|
||||||
# Handle in GUI thread
|
# Handle in GUI thread
|
||||||
self.network_signal.emit(event, args)
|
self.network_signal.emit(event, args)
|
||||||
elif event == 'on_quotes':
|
elif event == 'on_quotes':
|
||||||
|
@ -357,6 +357,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
self.do_update_fee()
|
self.do_update_fee()
|
||||||
# todo: update only unconfirmed tx
|
# todo: update only unconfirmed tx
|
||||||
self.history_list.update()
|
self.history_list.update()
|
||||||
|
elif event == 'ln_message':
|
||||||
|
lnworker, message = args
|
||||||
|
if lnworker == self.wallet.lnworker:
|
||||||
|
self.show_message(message)
|
||||||
else:
|
else:
|
||||||
self.print_error("unexpected network_qt signal:", event, args)
|
self.print_error("unexpected network_qt signal:", event, args)
|
||||||
|
|
||||||
|
|
|
@ -870,6 +870,7 @@ class Peer(PrintError):
|
||||||
self.send_commitment(chan) # htlc will be removed
|
self.send_commitment(chan) # htlc will be removed
|
||||||
await self.receive_revoke(chan)
|
await self.receive_revoke(chan)
|
||||||
self.lnworker.save_channel(chan)
|
self.lnworker.save_channel(chan)
|
||||||
|
self.network.trigger_callback('ln_message', self.lnworker, 'Payment failed')
|
||||||
|
|
||||||
async def _handle_error_code_from_failed_htlc(self, error_reason, route: List[RouteEdge], channel_id, htlc_id):
|
async def _handle_error_code_from_failed_htlc(self, error_reason, route: List[RouteEdge], channel_id, htlc_id):
|
||||||
chan = self.channels[channel_id]
|
chan = self.channels[channel_id]
|
||||||
|
@ -985,6 +986,7 @@ class Peer(PrintError):
|
||||||
self.send_commitment(chan) # htlc will be removed
|
self.send_commitment(chan) # htlc will be removed
|
||||||
await self.receive_revoke(chan)
|
await self.receive_revoke(chan)
|
||||||
self.lnworker.save_channel(chan)
|
self.lnworker.save_channel(chan)
|
||||||
|
self.network.trigger_callback('ln_message', self.lnworker, 'Payment sent')
|
||||||
|
|
||||||
# used in lightning-integration
|
# used in lightning-integration
|
||||||
self.payment_preimages[sha256(preimage)].put_nowait(preimage)
|
self.payment_preimages[sha256(preimage)].put_nowait(preimage)
|
||||||
|
@ -1018,6 +1020,7 @@ class Peer(PrintError):
|
||||||
chan.settle_htlc(preimage, htlc_id)
|
chan.settle_htlc(preimage, htlc_id)
|
||||||
await self.update_channel(chan, "update_fulfill_htlc", channel_id=channel_id, id=htlc_id, payment_preimage=preimage)
|
await self.update_channel(chan, "update_fulfill_htlc", channel_id=channel_id, id=htlc_id, payment_preimage=preimage)
|
||||||
self.lnworker.save_channel(chan)
|
self.lnworker.save_channel(chan)
|
||||||
|
self.network.trigger_callback('ln_message', self.lnworker, 'Payment received')
|
||||||
|
|
||||||
def on_revoke_and_ack(self, payload):
|
def on_revoke_and_ack(self, payload):
|
||||||
print("got revoke_and_ack")
|
print("got revoke_and_ack")
|
||||||
|
|
Loading…
Add table
Reference in a new issue