-
Notifications
You must be signed in to change notification settings - Fork 905
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
Offers: bolt12 updated for latest draft. #5676
Offers: bolt12 updated for latest draft. #5676
Commits on Nov 9, 2022
-
common: catch up on latest routeblinding spec.
This makes us match eed2ab0c30ad7f93e3b2641ca9d7ade32f3d121d ("Use `invalid_onion_blinding` everywhere"). 1. Numerous typographical changes. 2. Make sure we *always* return WIRE_INVALID_ONION_BLINDING if we're in a blinded path. 3. Handle p->total_msat correctly (MPP payments). 4. Reorganize blinding handling just like spec order. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6da922c - Browse repository at this point
Copy the full SHA 6da922cView commit details -
lightningd: don't return normal errors on blinded path entry, either.
This current spec is not strict enough: we might complain that the next peer is not connected, for example, which leaks information. So return WIRE_INVALID_ONION_BLINDING even if we're the first hop on the path, to be safe. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 873b599 - Browse repository at this point
Copy the full SHA 873b599View commit details -
common/onion: handle payment by node_id.
In a blinded path, you can specify node_id instead of scid. Handle that case. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6652206 - Browse repository at this point
Copy the full SHA 6652206View commit details -
common/onion: split into decode and encode routines.
Some places (e.g. the pay plugin) only need to construct onions, not decode them. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a1459b2 - Browse repository at this point
Copy the full SHA a1459b2View commit details -
plugins/libplugin-pay: hack in blinded path support.
We simply take the first one, and route to the start of that. Then we append the blinded path to the onion construction. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2c3c996 - Browse repository at this point
Copy the full SHA 2c3c996View commit details -
common/blindedpath: expose API at a lower level.
We actually want lightningd to create these, since it wants to put the path_id secret in the last element. So best API is actually a generic one, rather than separate APIs to create first and last ones. And really, the more explicit initialization makes the users clearer. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cbd44bb - Browse repository at this point
Copy the full SHA cbd44bbView commit details -
onion_message: don't use general secret, use per-message secret.
We had a scheme where lightningd itself would put a per-node secret in the blinded path, then we'd tell the caller when it was used. Then it simply checks the alias to determine if the correct path was used. But this doesn't work when we start to offer multiple blinded paths. So go for a far simpler scheme, where the secret is generated (and stored) by the caller, and hand it back to them. We keep the split "with secret" or "without secret" API, since I'm sure callers who don't care about the secret won't check that it doesn't exist! And without that, someone can use a blinded path for a different message and get a response which may reveal the node. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7e7174d - Browse repository at this point
Copy the full SHA 7e7174dView commit details -
invoice: invert check to reduce indentation.
Instead of doing command_fail() in the else, do it immediately then unindent the normal path. No code changes. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1f6cfe9 - Browse repository at this point
Copy the full SHA 1f6cfe9View commit details -
lightningd: temporarily ignore missing payment_secret for bolt12.
We're going to mess with it in the next patch... Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a640901 - Browse repository at this point
Copy the full SHA a640901View commit details -
createinvoice: make a minimal blinded "path" in bolt12 invoice if non…
…e presented. The "path" is just a message to ourselves. This meets the minimal requirement for bolt12 invoices: that there be a blinded path (at least so we can use the path_id inside in place of "payment_secret"). We expose the method to make this path_id to a common routine: offers will need this for generating more sophisticated paths. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 280af9b - Browse repository at this point
Copy the full SHA 280af9bView commit details -
common/onion_decode: put the path_id into onion_payload->payment_secret.
And check it in invoice.c, insead of a hack where we compare against invhash. Restore checking, too. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ab14776 - Browse repository at this point
Copy the full SHA ab14776View commit details -
listincoming: add htlc_min_msat, public and peer_features fields.
This is needed for offers to generate blinded paths. No documentation changes since listincoming is an undocumented internal hack interface which topology presents for production of routehints. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 36e06ff - Browse repository at this point
Copy the full SHA 36e06ffView commit details -
We need this to create the payment_constraints for an invoice blinded path. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f23cfbe - Browse repository at this point
Copy the full SHA f23cfbeView commit details -
offers: create a real blinded path, if necessary.
It's just to a direct peer, and we only create one, but this is enough to test, and make payments to non-public nodes work. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f7de717 - Browse repository at this point
Copy the full SHA f7de717View commit details -
common/bolt12: add code to generate offer_id, extract parts of streams.
The new spec removes the offer_id, in favor of mirroring all the fields. So we need a way of generating a convenient identifier to identify the offer, and this works. We also want to extract parts of streams elsewhere, so expose that. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3c5012a - Browse repository at this point
Copy the full SHA 3c5012aView commit details -
common/bolt12: code to initialize invreqs from offers, invs from invr…
…eqs. This is an important part of the coming spec: we mirror all fields, known and unknown. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 966030d - Browse repository at this point
Copy the full SHA 966030dView commit details -
common/features: add explicit bolt12 feature sets.
The spec only specifies the mpp bit for invoices, but in general they are separate spaces. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 044ba3b - Browse repository at this point
Copy the full SHA 044ba3bView commit details -
offers: make them always unsigned.
This is in preparation for the spec update where the signature field does not even exist. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 825c7ad - Browse repository at this point
Copy the full SHA 825c7adView commit details -
offers: remove 'send-invoice' offers support.
This has radically changed in the spec, so remove it now, and we'll reintroduce / rewrite it. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b611cbc - Browse repository at this point
Copy the full SHA b611cbcView commit details -
bolt12: import the latest spec, update to fit.
I know this is an unforgivably large diff, but the spec has changed so much that most of this amounts to a rewrite. Some points: * We no longer have "offer_id" fields, we generate that locally, as all offer fields are mirrored into invoice_request and then invoice. * Because of that mirroring, field names all have explicit offer/invreq/invoice prefixes. * The `refund_for` fields have been removed from spec: will re-add locally later. * quantity_min was removed, max == 0 now mean "must specify a quantity". * I have put recurrence fields back in locally. This brings us to 655df03d8729c0918bdacac99eb13fdb0ee93345 ("BOLT 12: add explicit invoice_node_id.") Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 30f2afc - Browse repository at this point
Copy the full SHA 30f2afcView commit details -
bolt12: update to modern signature scheme.
This changed, by popular demands. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 12f2433 - Browse repository at this point
Copy the full SHA 12f2433View commit details -
devtools/bolt12-cli: fix decode to understand modern fields.
Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for efec399 - Browse repository at this point
Copy the full SHA efec399View commit details -
bolt12: use spec field names, update decode API.
Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 095b532 - Browse repository at this point
Copy the full SHA 095b532View commit details -
decode: print unknown fields in bolt12 strings.
Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5e5f808 - Browse repository at this point
Copy the full SHA 5e5f808View commit details -
offers: use existing copied fields.
We no longer have to refer back to the offer for which we're making the invoice_request, or to the invoice_request we made for an invoice, as they are all mirrored (and we check!). It's clearer to simply look at the object directly. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 158f726 - Browse repository at this point
Copy the full SHA 158f726View commit details -
lightningd/invoice.c, plugins/fetchinvoice.c: use tlv_make_fields() i…
…nstead of towire/fromwire hack. I forgot this existed! Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 36f39de - Browse repository at this point
Copy the full SHA 36f39deView commit details -
bolt12: routines to hash the invreq parts.
This gives us a unique identifier, by which we can match an invoice to their invoice_request. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b792ad1 - Browse repository at this point
Copy the full SHA b792ad1View commit details -
db: add invoicerequests table.
We no longer use offers for "I want to send you money", but we'll use invoice_requests directly. Create a new table for them, and associated functions. The "localofferid" for "pay" and "sendpay" is now "localinvreqid". This is an experimental-only option, so document the change under experimental only. Signed-off-by: Rusty Russell <[email protected]> Changelog-EXPERIMENTAL: JSON-RPC: `pay` and `sendpay` `localofferid` is now `localinvreqid`.
Configuration menu - View commit details
-
Copy full SHA for 6eed623 - Browse repository at this point
Copy the full SHA 6eed623View commit details -
lightningd: add "savetodb" argument to createinvoicerequest, add list…
…invoicerequests/disableinvoicerequest This is how we put new invoice_requests into the db; this will be used by a new "invoicerequest" command which replaces "offerout". The API is now the same as the offers api. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3b17fe9 - Browse repository at this point
Copy the full SHA 3b17fe9View commit details -
lightningd: re-add 'offerout' functionality, as 'invoicerequest'.
Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 89d462f - Browse repository at this point
Copy the full SHA 89d462fView commit details -
bolt12: update comments to match latest spec.
No code changes. Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 643d1b4 - Browse repository at this point
Copy the full SHA 643d1b4View commit details -
check: fix warnings from shellcheck 0.8.0
And make errors gcc-style, so emacs can jump through the automatically. ``` In devtools/reduce-includes.sh line 21: echo -n "-$LINE" ^-- SC3037 (warning): In POSIX sh, echo flags are undefined. In devtools/reduce-includes.sh line 25: echo -n "." ^-- SC3037 (warning): In POSIX sh, echo flags are undefined. In tools/rel.sh line 6: prefix=$(printf '%s\n' "${from#$common}" | sed 's@[^/][^/]*@..@g') ^-----^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: prefix=$(printf '%s\n' "${from#"$common"}" | sed 's@[^/][^/]*@..@g') In tools/rel.sh line 7: printf '%s\n' "$prefix/${to#$common}" ^-----^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: printf '%s\n' "$prefix/${to#"$common"}" For more information: https://www.shellcheck.net/wiki/SC3037 -- In POSIX sh, echo flags are undef... https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... make: *** [Makefile:553: check-shellcheck] Error 123 ``` Signed-off-by: Rusty Russell <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6c25666 - Browse repository at this point
Copy the full SHA 6c25666View commit details