cameri / nostream

A Nostr Relay written in TypeScript
MIT License
747 stars 195 forks source link

[BUG] - Payments taking a long time to clear, or don't clear #342

Open nQuiz opened 1 year ago

nQuiz commented 1 year ago

Hi guys - thanks for making your tool available to the Nostr community!

We'd like to report an issue we have observed with the 'paid relay' feature, which we have deployed to relay.nquiz.io

When we do a fresh deploy, everything works as it should.

But, after some time of usage, generating multiple invoices, of which some are paid, some not, some expired, some not - the relay stops processing payments. So, even though the user has paid the lightning invoice, the relay can't figure it out and the user doesn't get admitted (/invoices page never says "payment successful", QR code remains on screen)

After we notice that this is happening, we perform the following hack:

  1. Launch the docker nostream-db container bash: docker exec -it nostream-db bash
  2. Log in to the DB: psql -U nostr_ts_relay
  3. Remove all of the invoices: delete from invoices;

After these steps, the relay begins to admit users again.

Is this something you are aware of? If so, is there a fix planned, or are there any workarounds we can use?

System:

cameri commented 10 months ago

@nQuiz We are going to need more information to understand what is causing the issue. Which payment processor are you using? Can you provide us with a count of the number of invoices by status? e.g. SELECT status, COUNT(*) FROM invoices GROUP BY status Please enable debug logging when this is happening and provide the logs while attempting to pay an invoice. You can enable debug logging by setting the DEBUG environment variable to worker:*. Make sure to disable debug logging once you are done testing.