Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@motorina0
Copy link
Collaborator

@motorina0 motorina0 commented May 8, 2024

Summary

This PR addresses an issue for failed outgoing payments.

If an outgoing payment (invoice paid by the user) is marked as failed, then it will be deleted after a certain time interval.
The (current) reason for deleting the failed outgoing payment is to unlock the user funds. Because while the payment is still present the amount is considered locked.

The issue is that sometimes the outgoing payment can be marked as failed for technical reason, BUT the invoice is not actually canceled.

The solution in this PR is to:

  • never mark a payment as failed unless the funding source explicitly returns a status that says the payment is failed
  • any technical errors will keep the invoice as pending
  • make sure get_payment_status for all funding sources returns failed under some condition
    • alby and poenixd have an issue here

@codecov
Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 76.82927% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 61.83%. Comparing base (b9e62bf) to head (d41a640).

Files Patch % Lines
lnbits/core/services.py 38.88% 11 Missing ⚠️
lnbits/wallets/corelightning.py 77.77% 2 Missing ⚠️
lnbits/wallets/corelightningrest.py 89.47% 2 Missing ⚠️
lnbits/core/views/payment_api.py 66.66% 1 Missing ⚠️
lnbits/wallets/alby.py 0.00% 1 Missing ⚠️
lnbits/wallets/eclair.py 50.00% 1 Missing ⚠️
lnbits/wallets/lnbits.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2481      +/-   ##
==========================================
+ Coverage   61.81%   61.83%   +0.01%     
==========================================
  Files          67       67              
  Lines        9583     9611      +28     
==========================================
+ Hits         5924     5943      +19     
- Misses       3659     3668       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@motorina0 motorina0 force-pushed the fix_pay_invoice_status branch from 767cecc to 117c93a Compare May 8, 2024 13:10
@motorina0 motorina0 self-assigned this May 9, 2024
@motorina0 motorina0 requested a review from dni May 9, 2024 07:21
@dni dni force-pushed the fix_pay_invoice_status branch from 50c949a to 5def2b8 Compare May 9, 2024 14:56
@motorina0 motorina0 force-pushed the fix_pay_invoice_status branch from d09731c to 37defa4 Compare May 9, 2024 15:56
@motorina0 motorina0 requested review from arcbtc and talvasconcelos May 9, 2024 16:00
@motorina0 motorina0 marked this pull request as ready for review May 9, 2024 16:10
@motorina0
Copy link
Collaborator Author

Note: regtest fails for reasons outside this PR. Should be fixed soon.

@dni dni force-pushed the fix_pay_invoice_status branch from 6fb7293 to 40f938d Compare May 9, 2024 16:27
@motorina0 motorina0 force-pushed the fix_pay_invoice_status branch from 40f938d to 68dfef7 Compare May 10, 2024 06:01
@motorina0 motorina0 changed the title Fix pay invoice status fix: pay invoice status May 10, 2024
@dni dni merged commit eae5002 into dev May 10, 2024
@dni dni deleted the fix_pay_invoice_status branch May 10, 2024 09:49
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.

2 participants