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

Max open invoices? #2

Closed
coinables opened this issue Mar 25, 2018 · 3 comments
Closed

Max open invoices? #2

coinables opened this issue Mar 25, 2018 · 3 comments

Comments

@coinables
Copy link

A new invoice is created when the user specifies an amount and clicks on the Tip button. This gives the end-user (tipper) the ability to initiate new invoices on the host's lightning node. What are the limitations when it comes to max open invoices on a node? Should expiry time be less than the default 3600 in this case?

@shesek
Copy link
Collaborator

shesek commented Mar 25, 2018

Right, it does give users the ability to freely create new invoices on the c-lightning node. That's not much different from an e-commerce website allowing users to store shopping cart information, invoices, etc. on the server. The main difference is that here its a one-click operation, while the checkout process on e-commerce is usually more complex. But that won't matter much to bots that wants to DDoS the service...

As for your question: the limitation is really up to server hosting it. Each invoice is a row in c-lightning's sqlite database and Lightning Charge's sqlite database. How many of these you can process and store depends on the storage, memory and CPU available on the server.

Note that Lightning Charge deletes unpaid invoices from both itself and c-lightning a few days after they expire, so the invoices will eventually be removed if they're not paid.

Should expiry time be less than the default 3600 in this case?

Whether they should is really up to you. But you can make the expiry time shorter by adding the following in nanotip.js:

@@ -39,7 +39,6 @@ app.post('/', (req, res, next) =>
     amount: req.body.amount
   , currency: req.body.currency
   , description: app.settings.title
+  , expiry: 120 // expire in 2 minutes
   , webhook: app.settings.url + '/webhook/' + webhookToken
   , metadata: { source: 'nanotip', checkout: { redirect_url: thankyouUrl }, info: req.body.info }
   })

I could also add this as a configuration option you can set more easily, created #4 to keep track of that.

@coinables
Copy link
Author

Each invoice is a row in c-lightning's sqlite database and Lightning Charge's sqlite database. How many of these you can process and store depends on the storage, memory and CPU available on the server.

Thank you, that is what I was wondering. I wasn't sure how many resources an invoice took from the c-lightning node, for example if each invoice had to be actively "listened for" by the node for new payments and if a flood of new invoices could cause stress on the node. If each invoice is only as intensive as a row in sqlite then, as you've stated, there's really no reason to be concerned over the number of open invoices.

@shesek
Copy link
Collaborator

shesek commented Mar 26, 2018

IIf each invoice is only as intensive as a row in sqlite then, as you've stated, there's really no reason to be concerned over the number of open invoices.

I verified this with @rustyrussell who is more qualified on this than I am, and yes - its just a row in the db.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants