always return a preimage
This commit is contained in:
parent
da693b8f81
commit
39d6ad4a02
1 changed files with 3 additions and 0 deletions
3
tasks.py
3
tasks.py
|
|
@ -186,6 +186,8 @@ async def _on_make_invoice(sp: NWCServiceProvider, pubkey: str, payload: Dict) -
|
|||
expiry=expiry)
|
||||
payment_status = await check_transaction_status(wallet_id=nwc.wallet, payment_hash=payment_hash)
|
||||
preimage = payment_status.preimage
|
||||
if not preimage: # Some backend do not return a preimage (eg. FakeWallet), so we fake it
|
||||
preimage = "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
res = {
|
||||
"type": "incoming",
|
||||
"invoice": payment_request,
|
||||
|
|
@ -225,6 +227,7 @@ async def _on_lookup_invoice(sp: NWCServiceProvider, pubkey: str, payload: Dict)
|
|||
raise Exception("Payment not found")
|
||||
invoice_data = bolt11_decode(payment.bolt11)
|
||||
is_settled = not payment.pending
|
||||
timestamp = payment.time or invoice_data.date
|
||||
res = {
|
||||
"type": "outgoing" if payment.is_out else "incoming",
|
||||
"invoice": payment.bolt11,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue