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

Offers Part 2: db and invoice infrastructure. #4256

Merged
merged 12 commits into from
Dec 15, 2020

Conversation

rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Dec 4, 2020

(Built on #4255: first 10 commits) That's merged!

This is the db changes for offers, and linking them to payments or invoices, especially so we can enforce atomicity (for single-use offers).

@PapauloGamerOfc
Copy link
Contributor

The Travis CI bot is failing on every PR!

@rustyrussell rustyrussell changed the title Offers Part2: db and invoice infrastructure. Offers Part 2: db and invoice infrastructure. Dec 9, 2020
@rustyrussell
Copy link
Contributor Author

Rebase on master

@rustyrussell rustyrussell marked this pull request as ready for review December 9, 2020 10:17
We often have the currency as a tal string.

Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
This allows us to mark an offer used when an invoice derived from it
is paid, and importantly, avoid any other invoices for the offer being
paid.

Signed-off-by: Rusty Russell <[email protected]>
This is for offers which have `send_invoice`: we need to associate the
payment with the original offer, in (the usual) case where it is a single
use offer.  We mark it used when it's paid, to avoid a race.

Signed-off-by: Rusty Russell <[email protected]>
The real work is done in a plugin, but provide enough API that we can
manipulate the db.
This means we can hand around unsigned bolt11s.

Signed-off-by: Rusty Russell <[email protected]>
This takes an unsigned bolt11 (or bolt12 if EXPERIMENTAL_FEATURES) string
and signs it and puts it in the database.

The invoice command could now be moved out to a plugin, in fact.

Changelog-Added: JSON-RPC: `createinvoice` new low-level invoice creation API.
Signed-off-by: Rusty Russell <[email protected]>
The database still calls them `bolt11`, but we treat them depending on
prefix.

Signed-off-by: Rusty Russell <[email protected]>
And handle bolt12 strings if EXPERIMENTAL_FEATURES.

Signed-off-by: Rusty Russell <[email protected]>
Note that we remove the redundant "is this the correct chain?"
check, since bolt11_decode and bolt12_decode do that internally
anyway (this was changed in 924cc04).

Signed-off-by: Rusty Russell <[email protected]>
This didn't compile, but since nothing depends yet on common/blindedpath.o
we don't build it yet.

Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell
Copy link
Contributor Author

Rebase on master x2

wallet/wallet.c Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
wallet/wallet.c Outdated Show resolved Hide resolved
lightningd/invoice.c Show resolved Hide resolved
lightningd/invoice.c Outdated Show resolved Hide resolved
lightningd/pay.c Outdated Show resolved Hide resolved
lightningd/pay.c Outdated Show resolved Hide resolved
lightningd/pay.c Outdated Show resolved Hide resolved
1. Hoist 7200 constant into the bolt12 heade2.
2. Make preimage the last createinvoice arg, so we could make it optional.
3. Check the validity of the preimage in createinvoice.
4. Always output used flag in listoffers.
5. Rename wallet offer iterators to offer_id iterators.
6. Fix paramter typos.
7. Rename `local_offer_id` parameter to `localofferid`.
8. Add reference constraints on local_offer_id db fields.
9. Remove cut/paste comment.
10. Clarify source of fatal() messages in wallet.

Signed-off-by: Rusty Russell <[email protected]>
@cdecker
Copy link
Member

cdecker commented Dec 15, 2020

ACK 01c92fe

@cdecker cdecker merged commit 723c160 into ElementsProject:master Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants