Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: can't send payment to blinded path when setting custom data records #9247

Open
ZZiigguurraatt opened this issue Nov 6, 2024 · 5 comments
Labels
blinded paths bug Unintended code behaviour P2 should be fixed if one has time payments Related to invoices/payments

Comments

@ZZiigguurraatt
Copy link

Background

can't send payment to blinded path when setting custom data records

Your environment

lnd version 0.18.3-beta commit=v0.18.3-beta

Actual behaviour

On node A generate an invoice:

$ lncli addinvoice --blind --amt 5

Then go to node B and pay the invoice:

lncli sendpayment --amp -f --data 3438382=0a21ff --pay_req=.....

but it fails with messages (edited for privacy):

+----------------------------------+--------------+--------------+--------------+-------+----------+--------------------+-----------------------------------------------------+
| HTLC_STATE                       | ATTEMPT_TIME | RESOLVE_TIME | RECEIVER_AMT | FEE   | TIMELOCK | CHAN_OUT           | ROUTE                                               |
+----------------------------------+--------------+--------------+--------------+-------+----------+--------------------+-----------------------------------------------------+
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_KEY @ 1st hop     
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
| INVALID_ONION_BLINDING @ 3rd hop
+----------------------------------+--------------+--------------+--------------+-------+----------+--------------------+-----------------------------------------------------+

Payment status: FAILED, reason: FAILURE_REASON_TIMEOUT
[lncli] FAILED

Notes:

  • If I remove --data 3438382=0a21ff, the payment routes.
  • lncli sendpayment -h|grep data is where I got the test value for --data 3438382=0a21ff from.

Expected behaviour

Payment should route

@ZZiigguurraatt ZZiigguurraatt added bug Unintended code behaviour needs triage labels Nov 6, 2024
@ZZiigguurraatt
Copy link
Author

Actually, I just realized I accidentally included an --amp flag in the example above, but when removing it, the same result still occurs.

@bitromortac
Copy link
Collaborator

It looks like route blinding is incompatible with sending custom records, see https://github.com/lightning/bolts/blob/master/04-onion-routing.md#requirements:

If it is the final node:

    MUST return an error if the payload contains other tlv fields than encrypted_recipient_data, current_path_key, amt_to_forward, outgoing_cltv_value and total_amount_msat.

@ZZiigguurraatt
Copy link
Author

Interesting. LNDK has the ability to send a note when paying BOLT12 offers using blinded paths. I wonder how that works. Here is an excerpt from the documentation. I've tested it with phoenix wallet and it shows the PAYER_NOTE on the recipient's phoenix wallet.

$ ./lndk-cli --network=mainnet pay-offer --help
	PayOffer pays a BOLT 12 offer, provided as a 'lno'-prefaced offer string

	Usage: lndk-cli pay-offer [OPTIONS] <OFFER_STRING> [AMOUNT] [PAYER_NOTE]

	Arguments:
	  <OFFER_STRING>  The offer string
	  [AMOUNT]        Amount the user would like to pay. If this isn't set, we'll assume the user is paying whatever the offer amount is
	  [PAYER_NOTE]    A payer-provided note which will be seen by the recipient

@ZZiigguurraatt
Copy link
Author

What is the encrypted_recipient_data? Could that be the PAYER_NOTE that LNDK exposes?

@bitromortac
Copy link
Collaborator

encrypted_recipient_data is a tlv that's encrypted by the receiver to detail how the routing should be done for each hop in the blinded route (see example in https://github.com/lightning/bolts/blob/master/proposals/route-blinding.md#blinded-payments). So a sender should not be able to append to that data.

I'm not sure, maybe in the BOLT12 flow, the note is sent to the recipient via the onion message and persisted, or included in an encrypted data field generated by the receiver for it to read once the payment arrives?

@saubyk saubyk added blinded paths payments Related to invoices/payments P2 should be fixed if one has time and removed needs triage labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blinded paths bug Unintended code behaviour P2 should be fixed if one has time payments Related to invoices/payments
Projects
None yet
Development

No branches or pull requests

3 participants