-
Notifications
You must be signed in to change notification settings - Fork 224
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
feat: Support re-attempt LN invoice payment #3322
Conversation
f249063
to
8a69351
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3322 /- ##
==========================================
Coverage 60.16% 60.34% 0.18%
==========================================
Files 193 193
Lines 40361 40510 149
==========================================
Hits 24283 24447 164
Misses 16078 16063 -15
☔ View full report in Codecov by Sentry. |
8a69351
to
4500812
Compare
4500812
to
7fed678
Compare
bf835c8
to
6c97c46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough, I have some ideas how to improve, but happy to merge.
6c97c46
to
12d50ea
Compare
12d50ea
to
f049733
Compare
Call: @m1sterc001guy could you backport if easy |
This one is unfortunately difficult. Major conflicts in lots of files :/ |
@justinmoon @m1sterc001guy curious if this one ended up being backported to 0.2. I ran into this, and combined with the lack of |
Yes, I see it in the release branch, here is one of the commits. What issue are you seeing? Maybe it's not covered by this fix. |
Seems like it timed out making the payment, refunded the ecash, then another attempt at paying the same invoice has issues. Here's some logs:
And that error repeats over and over again, presumably due to the lack of canceled update. Is there anything I should do on the client side to ensure that it's a new contract/operational id? |
I think this is another instance of the LN state update stream not yielding the
And since the payment has the same contract id, the gateway won't attempt to re-pay the same contract until the previous one is gone. #4014 Also, when investigating this, I think we also have a bug on the client side where it's possible the client transitions after 30 seconds, but the payment could be successful after that. #4021 |
Builds on: #3318 #3319
Fixes: #3248
Intuition: adds an
index
into theOperationId
hash so that multiple attempts to pay the same invoice are allowed. When creating the contract, the client checks to see if the contract (incoming or outgoing) already exists, and returns an error if it already does. If it does not, theindex
is incremented and committed to the database (this serves as a de-facto lock which prevents multiple threads from payment the same invoice at the same time).When the payment is successful, the
PayType
andContractId
are stored in the database, which allows subsequent payment attempts to just lookup the succuessful payment in the operation log, rather than re-initiating the payment.Open to suggestions on how to better test this.