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

Fix/invoice deletion #317

Merged
merged 6 commits into from
Feb 18, 2023
Merged

Fix/invoice deletion #317

merged 6 commits into from
Feb 18, 2023

Conversation

kiwiidb
Copy link
Contributor

@kiwiidb kiwiidb commented Feb 17, 2023

Fixes #311
The issue was that the "delete invoice" call didn't work and this was not noticed because the error wasn't logged.
We reproduced this but the real fix is to postpone the invoice db entry creation until after preliminary checks have taken place (amount, user balance, invoice expiry (todo #315 )).

In order to do this, this PR does the following things:

  • Move the duplicated BalanceCheck code to the service package
  • Move the CalcFeeLimit code from the invoice struct to the service struct
  • Move the AddOutgoingInvoice call in all 4 payment controllers behind the BalanceCheck block, which should look the same everywhere.
  • Add a test to make sure the invoice isn't there when we try to pay an invoice that we can't afford. You can verify that this test currently fails on main by cherry-picking commit 03a2014

@kiwiidb kiwiidb merged commit 28a4a4d into main Feb 18, 2023
@kiwiidb kiwiidb deleted the fix/invoice-deletion branch February 18, 2023 10:39
This pull request was closed.
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.

Fix invoice deletion after balance check
2 participants