1
0

Add tx_hashes to exported payment requests (#7936)

* Add `tx_hashes` to payment requests

* Apply patch

* Fix for missing lnworker
This commit is contained in:
MrNaif2018
2022-11-10 20:48:00 +03:00
committed by GitHub
parent 9f3a39e9c9
commit b357391c48

View File

@@ -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