-
Notifications
You must be signed in to change notification settings - Fork 912
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
Feat/unified invoices #6421
Feat/unified invoices #6421
Conversation
f07bc60
to
f5604f5
Compare
64d2e9f
to
8ca8dca
Compare
Hmm,. this is too late foir current release, but can we get that bolt11 bugfix in a PR by itself (ideally with a Changelog-Fixed: line?) |
@rustyrussell done, see #6435 |
e4a7424
to
283f5b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Complaints are in form, not function!
- Commits need some cleaning up
- Remove all the //
wallet/walletrpc.c
Outdated
const char *buffer, | ||
const jsmntok_t *obj UNNEEDED, | ||
const jsmntok_t *params) | ||
bool newaddr_inner(struct command *cmd, struct pubkey *pubkey, enum addrtype *addrtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should take ld
not cmd, and addrtype is a constant. In effect:
bool issue_new_address(struct lightningd *ld, enum addrtype addrtype, struct pubkey *pubkey);
wallet/db.c
Outdated
{SQL("CREATE TABLE invoice_fallbacks (" | ||
" scriptpubkey BLOB," | ||
" invoice_id BIGINT REFERENCES invoices(id) ON DELETE CASCADE," | ||
" PRIMARY KEY (scriptpubkey)" | ||
");"), | ||
NULL}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This MUST go at the end of the dbmigrations array!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was moved to the bottom in a later commit.
Thanks so much for the detailed review, @rustyrussell ! I'll get on this soon :) |
Rebased and cleaned up:
|
0fac5fe
to
6c3b2b1
Compare
Looks great @rustyrussell, thanks again for the assist on this! Looks like there are just a couple of things left:
I'll get started on this unless I hear back! |
6c3b2b1
to
009f525
Compare
I think I got them all, except for minor internal code things which can be fixed later... |
Expand to handle P2TR addresses, use the common script encoding utility function instead of reimplementing it.
Changelog-Added: Config: `invoices-onchain-fallback` to automatically add an onchain p2tr address to invoices, and allow that for payment.
i.e. `set` may be NULL, so we need to explicitly hand the amount. We also add an outpoint.
Changelog-Added: JSON-RPC: `listinvoices` new field `paid_outpoint` if an invoice is paid onchain.
YA rebase! |
009f525
to
c760744
Compare
c760744
to
bab6ca6
Compare
We can make it per-invoice next release, if we want, since it would be perfectly backward compatible. For now it's getting close to release... |
Support for tracking payments to fallback addresses (fixes #542)
Currently implemented behind the
invoices_onchain_fallback
config option.When this option is enabled, populate new invoices with a P2TR fallback address, and add the script to our
txfilter
so we can watch for payments to it, and store it in the newinvoice_fallbacks
child table. Adding fallbacks manually in theinvoice
rpc call will disable the new tracking behavior, and there is a warning to this effect.When we detect a payment to one of our fallback addresses, check the
invoice_fallbacks
table to see if there's an invoice associated with that script. If so, mark the invoice as paid and send out any hooks / notifications for this.