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 3. Offers and the plugins who love them! #4257

Merged
merged 13 commits into from
Dec 23, 2020

Conversation

rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Dec 4, 2020

This contains plugins both for creating offers and servicing invoice requests / invoices associated with them, and sending requests based on others' offers.

Changelog-None

@rustyrussell rustyrussell changed the title Offers part3: Offers: Part 3. Offer, and the plugins who love them! Dec 4, 2020
@PapauloGamerOfc
Copy link
Contributor

PapauloGamerOfc commented Dec 4, 2020

The Travis CI bot is failing on every PR!

hsmd/hsmd.c Show resolved Hide resolved
lightningd/hsm_control.c Show resolved Hide resolved
@cdecker
Copy link
Member

cdecker commented Dec 15, 2020

Rebased on top of #4256 now that it's merged.

@rustyrussell
Copy link
Contributor Author

Rebased on master since part 2 committed, no other changes.

@rustyrussell rustyrussell changed the title Offers: Part 3. Offer, and the plugins who love them! Offers: Part 3. Offers and the plugins who love them! Dec 16, 2020
Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f553635

plugins/offers.c Show resolved Hide resolved
hsmd/hsmd.c Outdated Show resolved Hide resolved
hsmd/hsmd.c Outdated Show resolved Hide resolved

inv1 = l1.rpc.call('fetchinvoice', {'offer': offer})
inv2 = l1.rpc.call('fetchinvoice', {'offer': offer})
assert inv1 != inv2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paying and then fetching should fail.

That way they rebuild when we change flags in Makefile.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
It's not trivial, but fortunately gmtime and mktime exist already.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We prepare an invoice, but there's no code to send an error reply yet
(future patch).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Invoices are signed with our own key, but we use a transient payer_key with a
tweak for invoice_requests (and refunds).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is similar to the createinvoice API, except we don't need to save
invoice requests in the database.  We may, however, have to look up
payment_key for recurring invoice requests, and sign the message with
the payment_key.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ffer

Doesn't catch the reply yet, but prepares the invoice request based on
the offer and sends it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Using onionmessage hook, we get the response and either present it
to the user (invoice) or return the error to the user.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…FEATURES)

This lets actually pay the invoice that fetchinvoice returns.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is useful for the caller to know when to call again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This also lets us extend our testing to cover error cases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@cdecker
Copy link
Member

cdecker commented Dec 23, 2020

Fixed the two typos and rebased on master (range-diff.

ACK d2e4c5c

@cdecker cdecker merged commit 52af729 into ElementsProject:master Dec 23, 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