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:
@@ -2399,6 +2399,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
'status': status,
|
'status': status,
|
||||||
'status_str': status_str,
|
'status_str': status_str,
|
||||||
'request_id': key,
|
'request_id': key,
|
||||||
|
"tx_hashes": []
|
||||||
}
|
}
|
||||||
if is_lightning:
|
if is_lightning:
|
||||||
d['rhash'] = x.rhash
|
d['rhash'] = x.rhash
|
||||||
@@ -2407,12 +2408,16 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
if self.lnworker and status == PR_UNPAID:
|
if self.lnworker and status == PR_UNPAID:
|
||||||
d['can_receive'] = self.lnworker.can_receive_invoice(x)
|
d['can_receive'] = self.lnworker.can_receive_invoice(x)
|
||||||
if address:
|
if address:
|
||||||
paid, conf = self.is_onchain_invoice_paid(x)
|
|
||||||
d['amount_sat'] = int(x.get_amount_sat())
|
d['amount_sat'] = int(x.get_amount_sat())
|
||||||
d['address'] = address
|
d['address'] = address
|
||||||
d['URI'] = self.get_request_URI(x)
|
d['URI'] = self.get_request_URI(x)
|
||||||
if conf is not None:
|
# if request was paid onchain, add relevant fields
|
||||||
d['confirmations'] = conf
|
# 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)
|
run_hook('wallet_export_request', d, key)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user