-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
No new notification is received via the /v1/invoices/subscribe API for duplicated invoice payments #6791
Comments
Hello @AzulPretoBranco I think that by default if you try to pay the same invoice twice you will get an error But that's your node playing nice. Bolt11 Invoices should not be payed more than once. If the user shares it with 100 people, and 3 of them pay it, you have no way to know who those three are. Paying the same invoice twice is not recommended. If I am one of the hops in the middle, I already saw the preimage for that invoice, which means that if the second payment goes through me I can take the full payment without having to forward it (i would be able to claim the htlc that the previous hop opened to me without having to create an htlc to the next hop) There are some invoices designed to be paid multiple times (AMP for example) but for what you specify this is not the case. Are you using your own node with lndhub on top of it or you are using the one from the bluewallet team? |
Hi @positiveblue, thanks for the answer,
Yes, I understand and agree with this, nevertheless, it is still technically possible, hence may question about whether or not we should receive a notification for the second payment.
Correct, I'm not using AMP invoices, I'm using the regular "normal" invoices, created with For now, lets forget about, Blue Wallet and LNDHub for the sake of simplicity. Here is my setup:
Looking at the code I can see that LND rejects duplicated payments in some flows but not others, for example, looking at
With that said I have two questions that maybe you can answer:
|
You are correct. First of all I had no idea about Lightning: Testnet Wallet. The app was using a really old version of the protocol, even before having tlvs, so it should be avoided. We have already removed it from the app store. No well-intentioned user should hit this because all the wallets are already updated and if someone hacks a tool to "exploit" it using the old format s/he is basically giving you money for free so it is not critical. We need to rewrite some of this logic (after 6288) so it gets easier to reason about but this is basically a bug (for an edge case but a bug). If you tried to paid them in the reversed order: first with the Testnet wallet and then with blue wallet you would see that your node refuses to take the payment.
Yes, it should notify you. This is something that shouldn't happen in production so it's low priority. I will create another issue to track it.
Yes, it has to be the sender the one that takes care of this because the sender cannot trust that the node s/he is paying to or any of the other nodes in the network will behave nicely. |
Yes, I noticed that.
Thanks, if possible please share the issue, I would like to keep an eye on it. @positiveblue ok, I feel like I understand this flow a little bit better, once again thanks for the explanation. |
Hi @positiveblue, I have a follow up question that maybe you can help with. Still regarding this flow, is there any way I can configure my LND node to always go through the My understanding is that only For example, I was taking a look at
For my use case, does it make sense if I set both of those flags to required instead of optional? Thanks! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Background
I'm working on a project that integrates with the LND REST API to, among other things, monitor payed invoices.
The flow is something like:
This simple flow works fine, the problem happens when the same invoice is payed twice.
For example, that 3rd party shares the invoice with a friend and both try to pay the same invoice.
If that happens we will only receive a notification via the /v1/invoices/subscribe API that an invoice was settled for the first payment.
The second payment will be silently accepted by the LND and, as far I as know, there is no way for me to know that the second payment happened.
Your environment
lnd
: lnd-linux-386-v0.15.0-beta.rc3uname -a
on *Nix): Ubuntu 20.04btcd
,bitcoind
, or other backend: bitcoin-22.0Steps to reproduce
I'm able to replicate this use case relatively easy, the steps are:
This is also a problem for other wallets like the Blue Wallet + LND Hub.
If we do the same steps:
Both payments succeed but inside the Blue Wallet the balance doesn't reflect accordingly, the second payment is "lost" (stays in LND only) and doesn't reach the Blue Wallet (I believe the reason could be connected to this problem, most likely Blue Wallet is not notified of the second payment)
Expected behaviour
I was expected to be notified of all payments, even duplicated ones, but that doesn't seem to happen.
Without some kind of notification it is not possible to realistically and accurately process invoice payments.
If you think adding a notification for the second payment doesn't make sense what about adding a configuration to LND to instead of silently accepting the second payment reject it instead?
Actual behaviour
No new notification is received via the /v1/invoices/subscribe API for duplicated invoice payments.
Any questions please ask.
The text was updated successfully, but these errors were encountered: