lndk-org / lndk

MIT License
76 stars 19 forks source link

server: get_invoice, pay_offer, decode_invoice endpoints #131

Closed orbitalturtle closed 6 days ago

orbitalturtle commented 3 weeks ago

This replaces #129. Thanks to @mauricepoirrier and @mrfelton for doing a lot of the work here.

This PR puts into place a few features requested by @mrfelton/Strike. It does the following:

orbitalturtle commented 3 weeks ago

I rebased this over #128, so it pulls in a few more commits than the actual PR for now. @mrfelton let me know how testing this goes or if there's anything else I can help with.

The main difference I noticed between your implementation and @mauricepoirrier's is that the invoice returned with get_invoice is an hex-encoded string rather than the Bolt12InvoiceData proto object. If you'd rather have the actual Bolt12InvoiceData object returned I'll look over that code tomorrow.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 0.00%. Comparing base (3eeb40f) to head (eff37bc). Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #131 +/- ## ====================================== Coverage 0.00% 0.00% ====================================== Files 1 1 Lines 97 97 ====================================== Misses 97 97 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mrfelton commented 3 weeks ago

Returning the invoice bytes as hex is ok for a final solution. However the issue right now is that it’s impossible to do anything with that string since LDK - and for us, the LDK C# bindings - currently has no readable support for Invoices. That’s the main reason why I went with the full proto object set in my initial version. So we either need a new release of LDK and the C# bindings with full reader/writer support (preferred) or we need this to return the full object breakdown.

mauricepoirrier commented 3 weeks ago

jkczys commented in the bolt12 discord that the readable implementation (that this must use too) will be available on 0.0.124. Writer should be already available. Maybe we have to double check the bindings.

orbitalturtle commented 3 weeks ago

@mrfelton Ohh ok got it. Would it help then for me to return the full object for now so you can test the endpoints? And then once LDK releases v124 in a couple weeks, change it back to the bytes?

mrfelton commented 3 weeks ago

It would definitely be helpful in the short term. My code probably needs a good check though. I think it’s ok. The only issue I’m aware of is the feature bits which I don’t think are being converted properly.

orbitalturtle commented 3 weeks ago

@mrfelton Sounds good, I added the full invoice object back in for now so you can test it.

Yeah the feature bit part is wonky, but everything else looks good to me. As long as payments are still working in your tests, it probably doesn't really matter since we're going to be replacing the object with the hex string with LDK v124 anyway

mrfelton commented 3 weeks ago

I'm getting this error @orbitalturtle when trying to fetch an invoice for an Offer from Eclair

ERROR lndk - We received an invoice request for a payment id that we don't recognize or already paid: PaymentId([95, 25, 116, 53, 120, 183, 86, 174, 24, 232, 71, 246, 227, 239, 222, 54, 131, 111, 189, 224, 132, 159, 94, 162, 35, 114, 130, 22, 188, 45, 242, 155]). We will ignore the invoice.

Full logs

2024-07-03 22:02:09 2024-07-03T20:02:09.939275382+00:00 DEBUG lndk::onion_messenger - Incoming messages sent: IncomingMessage(PublicKey(22742d021011b4f80dae1a3ce67077fbb0758a71283d9d1fecb32b4c79ce29d7fa5008d7a9337ddddd1cebd9f6966911877c82897cde40afff9e2a5413c5f7a6), OnionMessage { blinding_point: PublicKey(852a729964e019d2c3e5992f3f97a22f85ba25f777f660f674345815e3064128bfcf1897c0ed5306110cdca52fb1f220d0e877e6d5517b0e6bbadb71c02d4d8f), onion_routing_packet: Packet { version: 0, public_key: PublicKey(4fe5dee6977541edac8b5f1763ebdd8f24e5365ea5e497176b9ebc04335e358c937a208cc51ae76c539abc12d0b71af043896ca459aa99cbf776b1367a0395a2), hop_data: [118, 145, 70, 145, 174, 242, 211, 203, 1, 194, 86, 239, 53, 198, 126, 167, 220, 88, 185, 49, 147, 58, 56, 191, 232, 184, 89, 88, 197, 150, 142, 1, 77, 127, 65, 46, 11, 234, 248, 33, 68, 209, 175, 69, 141, 171, 176, 169, 125, 218, 82, 128, 84, 60, 119, 161, 4, 64, 5, 165, 72, 41, 37, 3, 198, 121, 194, 60, 215, 121, 5, 41, 93, 179, 113, 250, 32, 241, 17, 31, 236, 181, 186, 66, 86, 136, 163, 149, 214, 87, 31, 28, 150, 107, 92, 96, 16, 254, 244, 74, 140, 19, 249, 79, 81, 5, 216, 47, 253, 149, 142, 37, 138, 193, 11, 41, 23, 104, 100, 112, 140, 41, 201, 255, 100, 15, 155, 82, 34, 9, 233, 248, 188, 193, 205, 181, 124, 106, 13, 17, 22, 13, 130, 171, 48, 179, 41, 136, 14, 110, 255, 156, 25, 113, 14, 226, 158, 169, 49, 90, 206, 128, 240, 63, 135, 60, 24, 78, 98, 224, 204, 101, 253, 5, 51, 56, 167, 186, 158, 214, 209, 211, 49, 79, 141, 34, 186, 62, 44, 19, 51, 113, 167, 46, 130, 35, 130, 241, 101, 83, 149, 157, 76, 148, 67, 141, 152, 25, 157, 254, 23, 88, 131, 201, 136, 163, 3, 81, 131, 71, 201, 93, 134, 86, 41, 53, 229, 69, 183, 100, 154, 155, 43, 181, 247, 74, 102, 43, 240, 43, 98, 92, 139, 131, 126, 172, 17, 167, 91, 180, 182, 199, 159, 173, 226, 227, 50, 200, 237, 59, 233, 89, 242, 245, 247, 111, 195, 205, 237, 86, 45, 112, 242, 6, 66, 33, 209, 19, 72, 155, 110, 130, 150, 220, 11, 122, 12, 72, 73, 186, 73, 216, 148, 183, 140, 239, 103, 229, 158, 182, 231, 30, 60, 144, 221, 188, 182, 157, 89, 209, 69, 79, 109, 90, 156, 69, 91, 249, 165, 102, 21, 152, 170, 21, 186, 24, 143, 40, 102, 206, 56, 231, 25, 6, 199, 115, 8, 132, 107, 65, 135, 27, 74, 127, 44, 13, 191, 122, 102, 46, 225, 72, 181, 171, 37, 159, 187, 209, 159, 251, 51, 42, 111, 72, 103, 88, 74, 133, 202, 19, 217, 141, 182, 131, 43, 210, 2, 196, 53, 6, 3, 2, 17, 30, 15, 172, 111, 76, 95, 238, 85, 243, 246, 249, 215, 73, 205, 147, 245, 29, 191, 21, 122, 100, 197, 73, 99, 161, 141, 179, 201, 191, 158, 30, 204, 26, 29, 133, 111, 85, 26, 93, 29, 128, 219, 178, 1, 181, 139, 30, 45, 49, 233, 159, 180, 224, 231, 252, 156, 223, 61, 88, 166, 30, 30, 224, 45, 133, 62, 219, 192, 24, 234, 88, 209, 244, 76, 4, 101, 143, 244, 24, 200, 89, 152, 43, 188, 109, 36, 225, 243, 115, 178, 221, 129, 150, 204, 194, 127, 173, 32, 8, 247, 97, 146, 191, 220, 7, 204, 224, 162, 121, 203, 239, 34, 202, 84, 144, 0, 53, 33, 219, 231, 249, 220, 46, 116, 41, 89, 60, 52, 161, 166, 188, 57, 226, 128, 80, 157, 114, 77, 200, 169, 176, 101, 110, 64, 158, 210, 63, 222, 185, 12, 169, 236, 216, 126, 99, 126, 81, 210, 21, 0, 13, 244, 53, 254, 248, 170, 55, 3, 120, 254, 65, 128, 15, 208, 23, 131, 108, 142, 107, 128, 7, 211, 14, 193, 30, 195, 225, 141, 175, 138, 175, 116, 75, 132, 79, 208, 139, 246, 55, 219, 37, 204, 151, 42, 191, 36, 23, 150, 163, 130, 199, 218, 254, 20, 68, 7, 172, 105, 179, 219, 142, 45, 25, 193, 178, 161, 49, 50, 214, 101, 231, 124, 146, 71, 215, 241, 62, 125, 191, 77, 148, 85, 121, 96, 44, 39, 203, 115, 231, 93, 152, 233, 73, 181, 245, 127, 40, 18, 87, 0, 174, 95, 181, 197, 87, 5, 184, 70, 14, 149, 115, 22, 25, 254, 29, 148, 15, 45, 57, 104, 44, 255, 41, 99, 65, 123, 123, 102, 58, 56, 55, 147, 199, 9, 228, 182, 86, 166, 27, 91, 197, 106, 3, 180, 16, 46, 72, 8, 223, 145, 101, 213, 231, 178, 115, 17, 178, 112, 85, 92, 206, 6, 100, 235, 97, 57, 243, 8, 132, 95, 18, 64, 86, 223, 195, 97, 198, 95, 104, 100, 165, 142, 15, 178, 250, 204, 59, 230, 25, 172, 13, 22, 122, 48, 146, 23, 205, 40, 198, 202, 170, 6, 248, 38, 166, 103, 42, 72, 81, 250, 207, 137, 149, 249, 75, 26, 25, 147, 177, 129, 203, 214, 22, 245, 237, 139, 137, 32, 140, 252, 112, 1, 150, 189, 187, 2, 235, 179, 195, 202, 238, 112, 250, 31, 115, 60, 200, 56, 198, 88, 95, 238, 167, 166, 217, 18, 172, 98, 197, 231, 163, 48, 51, 155, 166, 25, 60, 219, 161, 64, 0, 83, 104, 42, 232, 180, 122, 36, 18, 126, 156, 228, 144, 237, 28, 244, 108, 225, 5, 15, 197, 8, 81, 85, 46, 122, 141, 223, 207, 68, 183, 1, 119, 179, 172, 111, 44, 246, 238, 195, 81, 166, 228, 214, 32, 10, 149, 117, 220, 186, 37, 95, 127, 93, 249, 191, 183, 179, 206, 69, 231, 104, 0, 212, 163, 177, 27, 59, 50, 153, 49, 1, 220, 100, 66, 218, 100, 237, 221, 76, 27, 179, 172, 161, 206, 128, 35, 106, 203, 75, 64, 111, 97, 78, 192, 60, 40, 141, 45, 206, 255, 40, 99, 162, 84, 202, 75, 201, 12, 212, 169, 166, 107, 64, 196, 43, 45, 172, 242, 195, 226, 53, 247, 11, 59, 187, 1, 36, 154, 119, 160, 244, 111, 123, 219, 150, 221, 35, 134, 178, 120, 32, 206, 204, 54, 168, 145, 225, 160, 113, 63, 231, 193, 190, 56, 22, 109, 240, 229, 60, 234, 253, 22, 194, 94, 140, 109, 181, 168, 172, 238, 122, 152, 37, 15, 243, 242, 99, 56, 108, 149, 12, 191, 243, 132, 204, 47, 201, 161, 192, 95, 246, 21, 105, 62, 225, 153, 50, 29, 28, 72, 235, 4, 176, 246, 101, 223, 141, 153, 27, 155, 129, 201, 162, 175, 197, 206, 235, 236, 255, 70, 8, 139, 135, 200, 165, 71, 102, 157, 207, 159, 87, 218, 28, 198, 80, 152, 170, 197, 219, 232, 185, 135, 152, 230, 24, 212, 63, 208, 157, 225, 53, 11, 226, 76, 9, 62, 8, 31, 57, 106, 152, 149, 155, 16, 96, 133, 98, 143, 236, 248, 226, 2, 110, 226, 237, 9, 141, 220, 143, 39, 151, 101, 81, 236, 183, 88, 251, 141, 93, 116, 56, 41, 178, 191, 214, 52, 66, 147, 28, 69, 196, 54, 40, 61, 190, 108, 45, 188, 197, 228, 113, 118, 0, 123, 63, 120, 34, 96, 236, 166, 9, 51, 114, 214, 12, 115, 59, 129, 183, 220, 115, 43, 116, 53, 153, 168, 240, 167, 188, 29, 114, 177, 238, 218, 94, 35, 211, 169, 65, 208, 244, 115, 255, 71, 15, 250, 222, 201, 119, 111, 237, 180, 189, 32, 8, 142, 240, 83, 225, 22, 231, 250, 87, 57, 91, 160, 113, 5, 34, 77, 173, 218, 54, 85, 202, 165, 155, 161, 112, 110, 147, 215, 184, 187, 146, 139, 54, 213, 169, 133, 171, 79, 12, 237, 218, 212, 65, 192, 83, 10, 209, 30, 42, 191, 208, 96, 125, 213, 18, 162, 166, 80, 139, 143, 152, 136, 54, 206, 154, 238, 98, 126, 96, 114, 25, 154, 161, 43, 155, 144, 11, 140, 242, 168, 248, 128, 65, 214, 236, 239, 198, 71, 254, 123, 202, 207, 185, 190, 239, 228, 254, 223, 238, 21, 215, 3, 226, 255, 11, 233, 237, 27, 100, 223, 2, 96, 10, 172, 136, 157, 165, 77, 158, 207, 245, 75], hmac: [209, 40, 194, 68, 246, 248, 250, 199, 170, 129, 121, 117, 39, 206, 126, 52, 10, 88, 73, 162, 93, 156, 132, 73, 239, 210, 183, 245, 6, 116, 183, 120] } }).
2024-07-03 22:02:09 2024-07-03T20:02:09.939830882+00:00 INFO lndk::onion_messenger - Consume messenger events received: messenger event: 02d729ce794c2bb3ec1f9d3d28718a75b0fb7770e63c1aae0df8b41110022d7422 incoming onion message.
2024-07-03 22:02:09 2024-07-03T20:02:09.947764173+00:00 TRACE ldk - Received an onion message with path_id None and no reply_path: Offers((PayerTlvStreamRef { metadata: Some([217, 223, 251, 81, 41, 169, 231, 128, 105, 105, 100, 95, 74, 38, 254, 239, 148, 190, 125, 45, 227, 206, 238, 195, 164, 167, 204, 222, 59, 75, 229, 150, 24, 227, 247, 40, 193, 4, 101, 3, 163, 181, 103, 53, 176, 157, 141, 217, 106, 208, 186, 93, 232, 227, 220, 235, 8, 214, 3, 238, 165, 218, 94, 120, 141, 4, 83, 225, 181, 19, 99, 22, 237, 213, 51, 25, 111, 31, 68, 158]) }, OfferTlvStreamRef { chains: Some([06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f]), metadata: None, currency: None, amount: None, description: Some("donation to eclair"), features: None, absolute_expiry: None, paths: None, issuer: None, quantity_max: None, node_id: Some(PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626)) }, InvoiceRequestTlvStreamRef { chain: Some(06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f), amount: Some(100000), features: None, quantity: None, payer_id: Some(PublicKey(f4a393d60df72838490530ec7e2af6985e8eb5e17d09ec8edc2b749db7963c22e3157f803c5de66801d7c6c1a8158cd7887321639c6e9d04e9077fd78fc0046f)), payer_note: None }, InvoiceTlvStreamRef { paths: Some(Iterable(Map { iter: Iter([(BlindedPayInfo { fee_base_msat: 0, fee_proportional_millionths: 0, cltv_expiry_delta: 30, htlc_minimum_msat: 0, htlc_maximum_msat: 100000, features: [] }, BlindedPath { introduction_node_id: PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626), blinding_point: PublicKey(fe6fba67c3496c32c8adc9d2869e946d9c0682ce2499d8df2cf782003922594983303924482d4c72184255ecfe16dc6f3772f1fccfea68db56fe37875de968e4), blinded_hops: [BlindedHop { blinded_node_id: PublicKey(ed6242c7268d719bcd857b4b497d12c946e28f2f6754d44267babd4ed094ce15243a73c2ed8719a38b9108581d4e5ac5122aaf2e55ee34ca199e6f4dffc84f7e), encrypted_payload: [56, 22, 140, 58, 244, 112, 33, 182, 151, 117, 27, 229, 90, 160, 198, 121, 153, 142, 255, 87, 191, 26, 120, 89, 232, 154, 233, 160, 122, 195, 216, 221, 238, 234, 82, 185, 206, 230, 176, 119, 223, 205, 235, 134, 172, 45, 29, 166, 110, 38, 48, 138, 54, 59, 191, 29, 19, 3, 73, 98, 38, 189, 2, 17, 181, 219, 174, 114, 101, 77, 173, 90, 197, 91, 150, 209, 158, 134, 131, 202, 177, 152, 150, 160, 92, 136, 239, 94, 54, 63, 188, 123, 91, 94, 196, 31, 76, 67, 254, 77, 252, 160, 237, 192, 32, 9, 68, 130, 188, 116, 200, 182, 183, 213, 19, 196, 204, 1, 71, 83, 31, 97, 41, 147, 209, 160, 65, 207, 221, 28, 222, 144, 218, 215, 65, 0, 217, 227, 13, 204, 37, 213, 139, 121, 132, 221, 121, 22, 223, 101, 191, 62, 76, 150, 168, 178, 141, 159, 139, 164, 71, 172, 246, 84, 41, 34, 161, 22, 30, 95, 131, 30, 12, 126, 199, 64, 219, 78, 95, 88, 40, 236, 21, 3, 14, 178, 217, 147, 241, 223, 22, 25, 161, 166, 159, 14, 103, 31, 110, 168, 32, 29, 91, 119, 67, 23] }] })]) })), blindedpay: Some(Iterable(Map { iter: Iter([(BlindedPayInfo { fee_base_msat: 0, fee_proportional_millionths: 0, cltv_expiry_delta: 30, htlc_minimum_msat: 0, htlc_maximum_msat: 100000, features: [] }, BlindedPath { introduction_node_id: PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626), blinding_point: PublicKey(fe6fba67c3496c32c8adc9d2869e946d9c0682ce2499d8df2cf782003922594983303924482d4c72184255ecfe16dc6f3772f1fccfea68db56fe37875de968e4), blinded_hops: [BlindedHop { blinded_node_id: PublicKey(ed6242c7268d719bcd857b4b497d12c946e28f2f6754d44267babd4ed094ce15243a73c2ed8719a38b9108581d4e5ac5122aaf2e55ee34ca199e6f4dffc84f7e), encrypted_payload: [56, 22, 140, 58, 244, 112, 33, 182, 151, 117, 27, 229, 90, 160, 198, 121, 153, 142, 255, 87, 191, 26, 120, 89, 232, 154, 233, 160, 122, 195, 216, 221, 238, 234, 82, 185, 206, 230, 176, 119, 223, 205, 235, 134, 172, 45, 29, 166, 110, 38, 48, 138, 54, 59, 191, 29, 19, 3, 73, 98, 38, 189, 2, 17, 181, 219, 174, 114, 101, 77, 173, 90, 197, 91, 150, 209, 158, 134, 131, 202, 177, 152, 150, 160, 92, 136, 239, 94, 54, 63, 188, 123, 91, 94, 196, 31, 76, 67, 254, 77, 252, 160, 237, 192, 32, 9, 68, 130, 188, 116, 200, 182, 183, 213, 19, 196, 204, 1, 71, 83, 31, 97, 41, 147, 209, 160, 65, 207, 221, 28, 222, 144, 218, 215, 65, 0, 217, 227, 13, 204, 37, 213, 139, 121, 132, 221, 121, 22, 223, 101, 191, 62, 76, 150, 168, 178, 141, 159, 139, 164, 71, 172, 246, 84, 41, 34, 161, 22, 30, 95, 131, 30, 12, 126, 199, 64, 219, 78, 95, 88, 40, 236, 21, 3, 14, 178, 217, 147, 241, 223, 22, 25, 161, 166, 159, 14, 103, 31, 110, 168, 32, 29, 91, 119, 67, 23] }] })]) })), created_at: Some(1720036874), relative_expiry: Some(3600), payment_hash: Some(PaymentHash([159, 246, 144, 181, 81, 84, 157, 87, 188, 37, 53, 177, 50, 115, 181, 238, 248, 3, 250, 107, 18, 156, 10, 125, 150, 165, 215, 31, 78, 123, 201, 15])), amount: Some(100000), fallbacks: None, features: Some([0, 0, 2]), node_id: Some(PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626)) }, SignatureTlvStreamRef { signature: Some(Signature(247a33c5a2d8dd635aa31c8a35901feee8ea657d893bd75a250318f43bd93d482c0aa4f3aa65d97fc446b5a082a5182d3662b361ba06aa06a423a391670cbcc5)) }))
2024-07-03 22:02:09 2024-07-03T20:02:09.947957590+00:00 INFO lndk - Received an invoice: Bolt12Invoice { bytes: [0, 80, 217, 223, 251, 81, 41, 169, 231, 128, 105, 105, 100, 95, 74, 38, 254, 239, 148, 190, 125, 45, 227, 206, 238, 195, 164, 167, 204, 222, 59, 75, 229, 150, 24, 227, 247, 40, 193, 4, 101, 3, 163, 181, 103, 53, 176, 157, 141, 217, 106, 208, 186, 93, 232, 227, 220, 235, 8, 214, 3, 238, 165, 218, 94, 120, 141, 4, 83, 225, 181, 19, 99, 22, 237, 213, 51, 25, 111, 31, 68, 158, 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, 10, 18, 100, 111, 110, 97, 116, 105, 111, 110, 32, 116, 111, 32, 101, 99, 108, 97, 105, 114, 22, 33, 3, 110, 36, 113, 8, 88, 134, 47, 88, 188, 124, 79, 28, 137, 216, 56, 69, 199, 45, 132, 193, 172, 37, 59, 47, 213, 33, 160, 230, 84, 56, 189, 126, 80, 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, 82, 3, 1, 134, 160, 88, 33, 3, 34, 60, 150, 183, 157, 116, 43, 220, 142, 236, 9, 125, 225, 181, 142, 94, 152, 246, 42, 126, 236, 48, 5, 73, 56, 40, 247, 13, 214, 147, 163, 244, 160, 253, 1, 52, 3, 110, 36, 113, 8, 88, 134, 47, 88, 188, 124, 79, 28, 137, 216, 56, 69, 199, 45, 132, 193, 172, 37, 59, 47, 213, 33, 160, 230, 84, 56, 189, 126, 3, 73, 89, 34, 57, 0, 130, 247, 44, 223, 216, 153, 36, 206, 130, 6, 156, 109, 148, 158, 134, 210, 201, 173, 200, 50, 108, 73, 195, 103, 186, 111, 254, 1, 2, 21, 206, 148, 208, 78, 189, 186, 103, 66, 212, 84, 103, 47, 143, 226, 70, 201, 18, 125, 73, 75, 123, 133, 205, 155, 113, 141, 38, 199, 66, 98, 237, 0, 206, 56, 22, 140, 58, 244, 112, 33, 182, 151, 117, 27, 229, 90, 160, 198, 121, 153, 142, 255, 87, 191, 26, 120, 89, 232, 154, 233, 160, 122, 195, 216, 221, 238, 234, 82, 185, 206, 230, 176, 119, 223, 205, 235, 134, 172, 45, 29, 166, 110, 38, 48, 138, 54, 59, 191, 29, 19, 3, 73, 98, 38, 189, 2, 17, 181, 219, 174, 114, 101, 77, 173, 90, 197, 91, 150, 209, 158, 134, 131, 202, 177, 152, 150, 160, 92, 136, 239, 94, 54, 63, 188, 123, 91, 94, 196, 31, 76, 67, 254, 77, 252, 160, 237, 192, 32, 9, 68, 130, 188, 116, 200, 182, 183, 213, 19, 196, 204, 1, 71, 83, 31, 97, 41, 147, 209, 160, 65, 207, 221, 28, 222, 144, 218, 215, 65, 0, 217, 227, 13, 204, 37, 213, 139, 121, 132, 221, 121, 22, 223, 101, 191, 62, 76, 150, 168, 178, 141, 159, 139, 164, 71, 172, 246, 84, 41, 34, 161, 22, 30, 95, 131, 30, 12, 126, 199, 64, 219, 78, 95, 88, 40, 236, 21, 3, 14, 178, 217, 147, 241, 223, 22, 25, 161, 166, 159, 14, 103, 31, 110, 168, 32, 29, 91, 119, 67, 23, 162, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 134, 160, 0, 0, 164, 4, 102, 133, 174, 10, 166, 2, 14, 16, 168, 32, 159, 246, 144, 181, 81, 84, 157, 87, 188, 37, 53, 177, 50, 115, 181, 238, 248, 3, 250, 107, 18, 156, 10, 125, 150, 165, 215, 31, 78, 123, 201, 15, 170, 3, 1, 134, 160, 174, 3, 2, 0, 0, 176, 33, 3, 110, 36, 113, 8, 88, 134, 47, 88, 188, 124, 79, 28, 137, 216, 56, 69, 199, 45, 132, 193, 172, 37, 59, 47, 213, 33, 160, 230, 84, 56, 189, 126, 240, 64, 36, 122, 51, 197, 162, 216, 221, 99, 90, 163, 28, 138, 53, 144, 31, 238, 232, 234, 101, 125, 137, 59, 215, 90, 37, 3, 24, 244, 59, 217, 61, 72, 44, 10, 164, 243, 170, 101, 217, 127, 196, 70, 181, 160, 130, 165, 24, 45, 54, 98, 179, 97, 186, 6, 170, 6, 164, 35, 163, 145, 103, 12, 188, 197], contents: ForOffer { invoice_request: InvoiceRequestContents { inner: InvoiceRequestContentsWithoutPayerId { payer: PayerContents([217, 223, 251, 81, 41, 169, 231, 128, 105, 105, 100, 95, 74, 38, 254, 239, 148, 190, 125, 45, 227, 206, 238, 195, 164, 167, 204, 222, 59, 75, 229, 150, 24, 227, 247, 40, 193, 4, 101, 3, 163, 181, 103, 53, 176, 157, 141, 217, 106, 208, 186, 93, 232, 227, 220, 235, 8, 214, 3, 238, 165, 218, 94, 120, 141, 4, 83, 225, 181, 19, 99, 22, 237, 213, 51, 25, 111, 31, 68, 158]), offer: OfferContents { chains: Some([06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f]), metadata: None, amount: None, description: "donation to eclair", features: [], absolute_expiry: None, issuer: None, paths: None, supported_quantity: One, signing_pubkey: PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626) }, chain: Some(06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f), amount_msats: Some(100000), features: [], quantity: None, payer_note: None }, payer_id: PublicKey(f4a393d60df72838490530ec7e2af6985e8eb5e17d09ec8edc2b749db7963c22e3157f803c5de66801d7c6c1a8158cd7887321639c6e9d04e9077fd78fc0046f) }, fields: InvoiceFields { payment_paths: [(BlindedPayInfo { fee_base_msat: 0, fee_proportional_millionths: 0, cltv_expiry_delta: 30, htlc_minimum_msat: 0, htlc_maximum_msat: 100000, features: [] }, BlindedPath { introduction_node_id: PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626), blinding_point: PublicKey(fe6fba67c3496c32c8adc9d2869e946d9c0682ce2499d8df2cf782003922594983303924482d4c72184255ecfe16dc6f3772f1fccfea68db56fe37875de968e4), blinded_hops: [BlindedHop { blinded_node_id: PublicKey(ed6242c7268d719bcd857b4b497d12c946e28f2f6754d44267babd4ed094ce15243a73c2ed8719a38b9108581d4e5ac5122aaf2e55ee34ca199e6f4dffc84f7e), encrypted_payload: [56, 22, 140, 58, 244, 112, 33, 182, 151, 117, 27, 229, 90, 160, 198, 121, 153, 142, 255, 87, 191, 26, 120, 89, 232, 154, 233, 160, 122, 195, 216, 221, 238, 234, 82, 185, 206, 230, 176, 119, 223, 205, 235, 134, 172, 45, 29, 166, 110, 38, 48, 138, 54, 59, 191, 29, 19, 3, 73, 98, 38, 189, 2, 17, 181, 219, 174, 114, 101, 77, 173, 90, 197, 91, 150, 209, 158, 134, 131, 202, 177, 152, 150, 160, 92, 136, 239, 94, 54, 63, 188, 123, 91, 94, 196, 31, 76, 67, 254, 77, 252, 160, 237, 192, 32, 9, 68, 130, 188, 116, 200, 182, 183, 213, 19, 196, 204, 1, 71, 83, 31, 97, 41, 147, 209, 160, 65, 207, 221, 28, 222, 144, 218, 215, 65, 0, 217, 227, 13, 204, 37, 213, 139, 121, 132, 221, 121, 22, 223, 101, 191, 62, 76, 150, 168, 178, 141, 159, 139, 164, 71, 172, 246, 84, 41, 34, 161, 22, 30, 95, 131, 30, 12, 126, 199, 64, 219, 78, 95, 88, 40, 236, 21, 3, 14, 178, 217, 147, 241, 223, 22, 25, 161, 166, 159, 14, 103, 31, 110, 168, 32, 29, 91, 119, 67, 23] }] })], created_at: 1720036874s, relative_expiry: Some(3600s), payment_hash: PaymentHash([159, 246, 144, 181, 81, 84, 157, 87, 188, 37, 53, 177, 50, 115, 181, 238, 248, 3, 250, 107, 18, 156, 10, 125, 150, 165, 215, 31, 78, 123, 201, 15]), amount_msats: 100000, fallbacks: None, features: [0, 0, 2], signing_pubkey: PublicKey(7ebd3854e6a021d52f3b25acc1842dc74538d8891c4f7cbc582f86580871246e3f6f2132e0cebbeef4f6f9ea602d2197669d4f6d6ee278e10404f83c76c35626) } }, signature: Signature(247a33c5a2d8dd635aa31c8a35901feee8ea657d893bd75a250318f43bd93d482c0aa4f3aa65d97fc446b5a082a5182d3662b361ba06aa06a423a391670cbcc5), tagged_hash: TaggedHash { tag: "lightninginvoicesignature", merkle_root: 0x25d422bb7ae2a3e5974f904b3d63b43c48d66d68a9f75b9df1968836a8547fe1, digest: Message(ca8860b97a91d72a1333bb5f295d8d5b6454e9fda53a31bc44f80559fed44b00) } }
2024-07-03 22:02:09 2024-07-03T20:02:09.948402048+00:00 ERROR lndk - We received an invoice request for a payment id that we don't recognize or already paid: PaymentId([228, 1, 94, 9, 71, 29, 255, 164, 65, 99, 164, 154, 172, 144, 245, 157, 243, 21, 182, 77, 104, 224, 238, 28, 46, 39, 226, 155, 42, 119, 57, 231]). We will ignore the invoice.
2024-07-03 22:02:09 2024-07-03T20:02:09.948433923+00:00 TRACE ldk - Missing reply path when responding to Offers onion message with path_id None
mrfelton commented 3 weeks ago

Maybe I had a borked build actually, as I've reset everything and am now running this PR plus the 2 commits from https://github.com/lndk-org/lndk/pull/121 and I can't reproduce that issue.

The fetch endpoint seems to work correctly, returning the full invoice object for the times where it is able to fetch an invoice (which itself seems to be quite random, but that's unconnected to the changes in this PR)

orbitalturtle commented 1 week ago

@dunxen Thanks for the review! Made those changes, if you can give it another blue check :)

dunxen commented 6 days ago

@dunxen Thanks for the review! Made those changes, if you can give it another blue check :)

Thanks @orbitalturtle :raised_hands:! When mrfelton's feedback has been addressed, this LGTM.

Ping me when ready :)

orbitalturtle commented 6 days ago

@dunxen Just made that last change!

dunxen commented 6 days ago

LGTM! Feel free to self-merge when ready 🎉

mrfelton commented 6 days ago

@orbitalturtle lets update the title of this PR to reflect the recent additions (also adds decode-invoice).