Browse Source

Add `tx_hashes` to exported payment requests (#7936)

* Add `tx_hashes` to payment requests

* Apply patch

* Fix for missing lnworker
patch-4
MrNaif2018 2 years ago
committed by GitHub
parent
commit
b357391c48
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      electrum/wallet.py

11
electrum/wallet.py

@ -2399,6 +2399,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
'status': status,
'status_str': status_str,
'request_id': key,
"tx_hashes": []
}
if is_lightning:
d['rhash'] = x.rhash
@ -2407,12 +2408,16 @@ class Abstract_Wallet(ABC, Logger, EventListener):
if self.lnworker and status == PR_UNPAID:
d['can_receive'] = self.lnworker.can_receive_invoice(x)
if address:
paid, conf = self.is_onchain_invoice_paid(x)
d['amount_sat'] = int(x.get_amount_sat())
d['address'] = address
d['URI'] = self.get_request_URI(x)
if conf is not None:
d['confirmations'] = conf
# if request was paid onchain, add relevant fields
# note: addr is reused when getting paid on LN! so we check for that.
is_paid, conf, tx_hashes = self._is_onchain_invoice_paid(x)
if is_paid and (not self.lnworker or self.lnworker.get_invoice_status(x) != PR_PAID):
if conf is not None:
d['confirmations'] = conf
d['tx_hashes'] = tx_hashes
run_hook('wallet_export_request', d, key)
return d

Loading…
Cancel
Save