Skip to content

[BUG] Receiver gets every notification twice for internal payments #4147

Closed

Description

@monasco

Describe the bug
When a wallet pays an invoice from another wallet on the same LNbits instance, the receiving wallet gets every notification two times. The webhook of the invoice is called twice. The websocket, Telegram, Nostr, email and push notifications are also sent twice. Payments from an external node are fine, only internal payments do this.

To Reproduce

  1. Create two wallets on one instance, wallet A and wallet B.
  2. In wallet B create an invoice with a webhook URL.
  3. Pay the invoice from wallet A.
  4. The webhook server gets two POST requests for the same payment.

Expected behavior
One notification per payment.

Screenshots
Log of my test webhook server, one payment:

21:51:22.281 POST /hook {"checking_id": "bbc5f289474a5361...
21:51:22.288 POST /hook {"checking_id": "bbc5f289474a5361...

Desktop (please complete the following information):

  • LNbits version: dev, commit d941f0a (1.6.0)
  • Database: sqlite

Additional context
In lnbits/core/services/payments.py, _pay_internal_invoice calls _send_payment_notification_in_background for the receiver and then also puts the payment on internal_invoice_queue. The core listener dispatch_payment_notification from lnbits/app.py reads that queue and sends the same notifications again.

I have a fix and will open a pull request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions