lndk-org / lndk

MIT License
84 stars 22 forks source link

Bug: Unable to pay to Bolt 12 offers to CLN node #103

Open mrfelton opened 6 months ago

mrfelton commented 6 months ago

Describe the bug I seem to be unable to pay to a Bolt 12 invoice generated by CLN.

Should be able to pay the offer.

Generate a Bolt 12 invoice on CLN

bolt12-playground on  cln [!?] via 🐳 desktop-linux via 🐍 v3.11.8 (zap-devenv-py3.11) via ❄️  impure (devenv-shell-env) took 18s
❯ ./bin/clncli offer 10000 "test offer from cln"
{
   "offer_id": "6e322a6450edc31661b8376e6f2a25f23ef9eefa8f984914e7ab9537eb5034e2",
   "active": true,
   "single_use": false,
   "bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqgn3qzsnw3jhxapqdanxvetjypn8ymmdyp3kcmskyypd6pxmsez7v27lrzkya86ktztm534cnp23g2d2l5yyy8t5t3ygnfg",
   "used": false,
   "created": true
}

Decode the invoice using LNDK

bolt12-playground on  cln [!?] via 🐳 desktop-linux via 🐍 v3.11.8 (zap-devenv-py3.11) via ❄️  impure (devenv-shell-env)
❯ ./bin/lndk-cli decode lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqgn3qzsnw3jhxapqdanxvetjypn8ymmdyp3kcmskyypd6pxmsez7v27lrzkya86ktztm534cnp23g2d2l5yyy8t5t3ygnfg
Decoding offer: lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqgn3qzsnw3jhxapqdanxvetjypn8ymmdyp3kcmskyypd6pxmsez7v27lrzkya86ktztm534cnp23g2d2l5yyy8t5t3ygnfg.
Decoded offer: Offer { bytes: [2, 32, 6, 34, 110, 70, 17, 26, 11, 89, 202, 175, 18, 96, 67, 235, 91, 191, 40, 195, 79, 58, 94, 51, 42, 31, 199, 178, 183, 60, 241, 136, 145, 15, 8, 2, 39, 16, 10, 19, 116, 101, 115, 116, 32, 111, 102, 102, 101, 114, 32, 102, 114, 111, 109, 32, 99, 108, 110, 22, 33, 2, 221, 4, 219, 134, 69, 230, 43, 223, 24, 172, 78, 159, 86, 88, 151, 186, 70, 184, 152, 85, 20, 41, 170, 253, 8, 66, 29, 116, 92, 72, 137, 165], contents: OfferContents { chains: Some([06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f]), metadata: None, amount: Some(Bitcoin { amount_msats: 10000 }), description: "test offer from cln", features: [], absolute_expiry: None, issuer: None, paths: None, supported_quantity: One, signing_pubkey: PublicKey(a589485c741d4208fdaa29145598b846ba9758569f4eac18df2be64586db04dd64a93e8286d617aa8db2a030bcc67f1493f4543d3fe4c1c4710251832cbb1983) } }.

Attempting to pay the offer from lndk

bolt12-playground on  cln [!?] via 🐳 desktop-linux via 🐍 v3.11.8 (zap-devenv-py3.11) via ❄️  impure (devenv-shell-env)
❯ ./bin/lndk-cli pay-offer lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqgn3qzsnw3jhxapqdanxvetjypn8ymmdyp3kcmskyypd6pxmsez7v27lrzkya86ktztm534cnp23g2d2l5yyy8t5t3ygnfg
2024-05-05T10:40:46.688023260+00:00 INFO lndk - Starting lndk for node: 03f42b31c4ee1870a75762c84c165bb74991f3e78818baaf4ad3f908804edda018.
2024-05-05T10:40:46.689176718+00:00 INFO lndk::onion_messenger - Consume messenger events received: messenger event: 02dd04db8645e62bdf18ac4e9f565897ba46b898551429aafd08421d745c4889a5 connected, onion message support: true.
2024-05-05T10:40:46.794970760+00:00 INFO lndk::onion_messenger - Sending outgoing onion message to 02dd04db8645e62bdf18ac4e9f565897ba46b898551429aafd08421d745c4889a5.
2024-05-05T10:42:26.759055+00:00 ERROR lndk - Did not receive invoice in 100 seconds.
Error paying for offer: InvoiceTimeout

Logs from CLN:

cln1-1      | 2024-05-05T10:40:46.796Z DEBUG   02dd04db8645e62bdf18ac4e9f565897ba46b898551429aafd08421d745c4889a5-hsmd: Got WIRE_HSMD_ECDH_REQ
cln1-1      | 2024-05-05T10:40:46.797Z DEBUG   hsmd: Client: Received message 1 from client
cln1-1      | 2024-05-05T10:40:46.797Z DEBUG   02dd04db8645e62bdf18ac4e9f565897ba46b898551429aafd08421d745c4889a5-hsmd: Got WIRE_HSMD_ECDH_REQ
cln1-1      | 2024-05-05T10:40:46.797Z DEBUG   hsmd: Client: Received message 1 from client
cln1-1      | 2024-05-05T10:40:46.798Z DEBUG   lightningd: Got onionmsg reply_path
cln1-1      | 2024-05-05T10:40:46.798Z DEBUG   lightningd: Calling onion_message_recv hook of plugin offers
cln1-1      | 2024-05-05T10:40:46.807Z DEBUG   hsmd: Client: Received message 25 from client
cln1-1      | 2024-05-05T10:40:46.808Z DEBUG   plugin-offers: sendonionmessage gave JSON error: {\"code\":-1,\"message\":\"Unknown first peer\"}
cln1-1      | 2024-05-05T10:40:46.808Z DEBUG   lightningd: Plugin offers returned from onion_message_recv hook call

Environment

Please do not include private information in bug reports!

To Reproduce

See https://github.com/LN-Zap/bolt12-playground - follow the README.

orbitalturtle commented 6 months ago

@mrfelton thanks for giving this a test run! Yeah hopefully once the CLN issue that you pointed to is resolved we'll be able to pay CLN offers. Eclair works, and I believe LDK produced offers should work with the latest release as well, though I still need to test/confirm with ldk-sample or something

mrfelton commented 6 months ago

Yes - can confirm I do have this working with Eclair, so can confirm the issue looks to be with CLN specifically.

AndySchroder commented 1 month ago

I'm having issues with CLN as well. Here are some test results.

This case fails (CLN sender: "WIRE_INVALID_ONION_BLINDING (reply from remote)"):

                    BOLT12 offer with blinded paths                                  
   sender                                                                   receiver 
+-----------+   public   +-----------+   public     +--------+   private   +--------+
|   CLN     |   channel  |  public   |   channel    |  LND   |   channel   |  CLN   |
|   v24.08  |   ------>  |  network  |   ------->   |  LNDK  |  ------->   | v24.08 |
+---------- +            +-----------+              +--------+             +--------+

This case fails (LND sender: "failed: InvalidOnionHMAC"):

                    BOLT12 offer without blinded paths        
  receiver                                            sender  
+-----------+   public   +-----------+   public     +--------+
|   CLN     |   channel  |  public   |   channel    |  LND   |
|   v24.08  |   <------  |  network  |   <-------   |  LNDK  |
+---------- +            +-----------+              +--------+

This case fails (Strike sender: "We were unable to find a payment route"):

                    BOLT12 offer without blinded paths        
  receiver                                            sender  
+-----------+   public   +-----------+   public     +--------+
|   CLN     |   channel  |  public   |   channel    | strike |
|   v24.08  |   <------  |  network  |   <-------   |        |
+---------- +            +-----------+              +--------+

This case succeeds:

                    BOLT12 offer without blinded paths                              
  receiver                                                                   sender  
+-----------+   public   +-----------+   public     +--------+   private   +--------+
|   CLN     |   channel  |  public   |   channel    |  LND   |   channel   |  CLN   |
|   v24.08  |   <------  |  network  |   <-------   |  LNDK  |  <-------   | v24.08 |
+---------- +            +-----------+              +--------+             +--------+

This case succeeds:

                    BOLT12 offer with blinded paths                              
  receiver                                                                                   sender  
+---------------------------+      ?     +-----------+   public     +--------+   private   +--------+
|   matt@mattcorallo.com    |   channel  |  public   |   channel    |  LND   |   channel   |  CLN   |
|    probably LDK?          |   <------  |  network  |   <-------   |  LNDK  |  <-------   |        |
+-------------------------- +            +-----------+              +--------+             +--------+

This case succeeds:

                    BOLT12 offer with blinded paths                              
  receiver                                                            sender  
+---------------------------+      ?     +-----------+   public     +--------+
|   matt@mattcorallo.com    |   channel  |  public   |   channel    |  LND   |
|    probably LDK?          |   <------  |  network  |   <-------   |  LNDK  |
+-------------------------- +            +-----------+              +--------+
AndySchroder commented 1 month ago

I did some more tests:

This case succeeds:

                    BOLT12 offer with blinded paths                              
  receiver                                                                     sender  
+-------------+      ?     +-----------+   public     +--------+   private   +--------+
|   phoenix   |   channel  |  ACINQ    |   channel    |  LND   |   channel   |  CLN   |
|    wallet   |   <------  |           |   <-------   |  LNDK  |  <-------   |        |
+------------ +            +-----------+              +--------+             +--------+

This case succeeds:

                    BOLT12 offer with blinded paths                              
  receiver                                              sender  
+-------------+      ?     +-----------+   public     +--------+
|   phoenix   |   channel  |  ACINQ    |   channel    |  LND   |
|   wallet    |   <------  |           |   <-------   |  LNDK  |
+-------------+            +-----------+              +--------+
AndySchroder commented 1 month ago

This case fails:

                    BOLT12 offer without blinded paths        
  receiver                                            sender  
+-----------+   public   +-----------+   ?          +---------+
|   CLN     |   channel  |  public   |   channel    | phoenix |
|   v24.08  |   <------  |  network  |   <-------   | wallet  |
+---------- +            +-----------+              +---------+
AndySchroder commented 1 month ago

This case fails:

                    BOLT12 offer with blinded paths                              
   sender                                                                     receiver  
+-------------+      ?     +-----------+   public     +--------+   private   +--------+
|   phoenix   |   channel  |  ACINQ    |   channel    |  LND   |   channel   |  CLN   |
|    wallet   |   ------>  |           |   ------->   |  LNDK  |  ------->   |        |
+------------ +            +-----------+              +--------+             +--------+
AndySchroder commented 1 month ago

This case fails (also because of https://github.com/lndk-org/lndk/issues/123 ?) :

 BOLT12 offer with blinded paths                                  
   sender                receiver 
+--------+   private   +--------+
|  LND   |   channel   |  CLN   |
|  LNDK  |  ------->   | v24.08 |
+--------+             +--------+
AndySchroder commented 1 month ago

@TheBlueMatt can you confirm what type of node your offer stored at matt@mattcorallo.com uses? Since I've used it as a test case above, would like to be able to clarify what that test case represented. I'm guessing this is LDK? If so, can you pay CLN offers from LDK?

TheBlueMatt commented 1 month ago

Yes it's LDK. It's a bit of an old LDK but it should work I don't think we've changed any BOLT 12 compat stuff in the latest release.