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

Do not retry sending if payment gets confirmed on chain #1799

Merged
merged 3 commits into from
May 17, 2021
Merged

Do not retry sending if payment gets confirmed on chain #1799

merged 3 commits into from
May 17, 2021

Conversation

akumaigorodski
Copy link
Contributor

This fixes a case where MultiPartPaymentLifecycle keeps retrying a payment even after it got confirmed on chain. Doing so is harmless but meaningless.

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

Good catch!

private def isFinalRecipientFailure(pf: PaymentFailed, d: PaymentProgress): Boolean = pf.failures.collectFirst {
/** When we receive an error from the final recipient or payment gets confirmed on chain, we should fail the whole payment, it's useless to retry. */
private def doNotRetry(pf: PaymentFailed, d: PaymentProgress): Boolean = pf.failures.collectFirst {
case LocalFailure(_, _: HtlcsTimedoutDownstream | _: HtlcOverriddenByLocalCommit) => true
Copy link
Member

Choose a reason for hiding this comment

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

This is HtlcsWillTimeoutUpstream as well.
You should probably create a dedicated method isOnChainFail(f: PaymentFailure).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems I'd have to do exactly the same matching in a new method, what about keeping as is but expanding each case: 776d9df#diff-f28a1f15ee9515a9b2bb404c65cb4a01415b12d264f509420bdfb1251fd49afbR382-R388 ?

@codecov-commenter
Copy link

codecov-commenter commented May 15, 2021

Codecov Report

Merging #1799 (858fa2f) into master (90fbcd3) will decrease coverage by 0.00%.
The diff coverage is 81.81%.

@@            Coverage Diff             @@
##           master    #1799      +/-   ##
==========================================
- Coverage   89.34%   89.33%   -0.01%     
==========================================
  Files         144      143       -1     
  Lines       10934    10934              
  Branches      458      464       +6     
==========================================
- Hits         9769     9768       -1     
- Misses       1165     1166       +1     
Impacted Files Coverage Δ
...clair/payment/send/MultiPartPaymentLifecycle.scala 93.91% <75.00%> (-1.19%) ⬇️
...r/acinq/eclair/payment/send/PaymentLifecycle.scala 92.90% <100.00%> (ø)
...clair/blockchain/bitcoind/rpc/BatchingClient.scala 86.36% <0.00%> (-13.64%) ⬇️
...cala/fr/acinq/eclair/payment/relay/NodeRelay.scala 96.09% <0.00%> (-1.57%) ⬇️
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 92.65% <0.00%> (-0.13%) ⬇️
.../src/main/scala/fr/acinq/eclair/router/Graph.scala 98.14% <0.00%> (-0.02%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 86.39% <0.00%> (ø)
...ain/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala 96.34% <0.00%> (ø)
...ain/scala/fr/acinq/eclair/channel/AliasActor.scala
...cinq/eclair/blockchain/bitcoind/zmq/ZMQActor.scala 95.12% <0.00%> (+0.12%) ⬆️
... and 2 more

@t-bast t-bast merged commit 0805d51 into ACINQ:master May 17, 2021
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