damus-io / damus

iOS nostr client
GNU General Public License v3.0
1.95k stars 289 forks source link

Change server to use `listinvoices` instead of `waitinvoice` RPC command #1983

Open alltheseas opened 4 months ago

alltheseas commented 4 months ago

use invoice command (as opposed to wait invoice) doesn't hold open

jb55 commented 4 months ago

listinvoices

args: {"invstring": "invstring=bolt11"} results: { invoices: [] }

should return 1 result with the invoice with the status set to paid, otherwise the status will be expired or unpaid.

danieldaquino commented 4 months ago

listinvoices args: {"invstring": "invstring=bolt11"} results: { invoices: [] } should return 1 result with the invoice with the status set to paid, otherwise the status will be expired or unpaid.

Thank you @jb55 for this. I tried implementing changes to use listinvoices earlier today (It was also relevant to some of the LN flow hardening work), but it seems that the LN rune of ln.damus.io only allows invoice and waitinvoice. Can you please double-check the LN node configuration?

alltheseas commented 4 months ago

lower in priority than most other 1.7 purple items, as apple permission not required.

@danieldaquino : change wait invoice to list invoice.

Also make this CoreLN plugin.

Add:

alltheseas commented 4 months ago

How to test on production:

see invoice, and simulate payment.

Doesn't have to be plugin. Can be script. Whenever invoices is seen (waitanyinvoice). Only works for paid invoices, unclear if can be tested without a paid invoice.

dda: Can this script be run on server? w: can be one msat (less than sat)

@jb55 to provide @danieldaquino code in theory to test how sats are seen on server

danieldaquino commented 3 months ago

Found a tool that might help with Lightning network testing: https://github.com/scaling-lightning/scaling-lightning

danieldaquino commented 3 months ago

@jb55, @alltheseas, I believe we are accidentally tracking two issues in this ticket:

I think these are independent tasks that might be better tracked separately, so I will split this ticket into two. Please feel free to merge them back if you see they have to be done at the same time.

danieldaquino commented 3 months ago

Opened https://github.com/damus-io/damus/issues/2035

jb55 commented 3 months ago

On Wed, Mar 06, 2024 at 11:25:54AM -0800, Daniel D’Aquino wrote:

Found a tool that might help with Lightning network testing: https://github.com/scaling-lightning/scaling-lightning

Testing the lightning network is way out of the scope of anything we will be doing

This ticket is more of an issue with proxying lightning over websockets, there must be a subtle websocket bug in some browsers or something.

danieldaquino commented 3 months ago

On Mar 7, 2024, at 07:06, William Casarin @.***> wrote:

On Wed, Mar 06, 2024 at 11:25:54AM -0800, Daniel D’Aquino wrote:

Found a tool that might help with Lightning network testing: https://github.com/scaling-lightning/scaling-lightning

Testing the lightning network is way out of the scope of anything we will be doing

This ticket is more of an issue with proxying lightning over websockets, there must be a subtle websocket bug in some browsers or something.

I apologize, my comment was not clear.

I posted that link because I believed I could use that to setup a dev environment where I can develop a CLN plugin or script on the LN node to ping our server as soon as invoices are paid.

I also recently found this: https://docs.corelightning.org/docs/developers-guide, where they seem to provide a way to setup a dev environment with a simulated CLN node. This might be a simpler way to get a dev environment up and running.

I am not trying to test lightning network itself, I am trying to have some test CLN node so that I have something to connect my plugin/script to, in order to do local testing during development.

(Please note this CLN plugin/script stuff is now being tracked on https://github.com/damus-io/damus/issues/2035, I split the ticket after writing that comment. This particular ticket now tracks only changing from waitinvoice to listinvoices on our server)