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

Don't relay buggy extra payments #2937

Merged
merged 4 commits into from
Nov 8, 2024
Merged

Don't relay buggy extra payments #2937

merged 4 commits into from
Nov 8, 2024

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Nov 6, 2024

If a payer is buggy and tries to pay the same invoice multiple times, it can lead to an edge case where the recipient accepted the first one and purchased liquidity for it, but didn't purchase additional liquidity and thus cannot receive the duplicate payments.

Also, when replaying parts that were waiting for an on-the-fly funding, we set commit = false to all parts, instead of just the last one. This optimization caused the payment to be stuck if the last part was unexpectedly rejected (which would for example happen in the buggy payer case described above, before we rejected those extra payments).

t-bast and others added 3 commits November 1, 2024 15:58
If a payer is buggy and tries to pay the same invoice multiple times,
it can lead to an edge case where the recipient accepted the first one
and purchased liquidity for it, but didn't purchase additional liquidity
and thus cannot receive the duplicate payments.

In that case, the recipient may even have released the preimage, so the
LSP (or any other node in the route) could steal the entire duplicate
payment.

To prevent that, we immediately fail such buggy duplicate payments. Note
that if the first payment was fully completed, we don't fail the extra
payments and the payer could get screwed, but they're buggy so it's their
problem...
When replaying parts that were waiting for an on-the-fly funding, we
explicitly set `commit = false` to all parts but the last one, in order
to save us from signing multiple times.

But this has side effects in the case where the last part is rejected
for some reason, because previous parts stay stuck waiting for a
`CMD_SIGN` that never arrives.
@pm47 pm47 requested review from t-bast and remyers and removed request for t-bast November 6, 2024 15:19
remyers
remyers previously approved these changes Nov 8, 2024
Copy link
Contributor

@remyers remyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

The changes appear straight forward wrt the issues described.

@pm47 pm47 merged commit f4efd64 into master Nov 8, 2024
1 check passed
@pm47 pm47 deleted the otf-reject-extra branch November 8, 2024 13:04
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

Successfully merging this pull request may close these issues.

3 participants