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

Skip to content

Conversation

@motorina0
Copy link
Collaborator

@motorina0 motorina0 commented May 21, 2024

Summary

Do not allow payments from extensions that are disabled by the user.

Steps:

  • user enables withdraw extension
  • user create withdraw link and shares it
  • user disables withdraw extension

Actual Result:

  • withdraw link still working

Expected Result:

  • withdraw link does not work until the withdraw extension is enabled again

Note:

  • this functionality relies on the fact that extensions use the "tag" field in the "'extra'" options

    • this is not enforced in the code in any way at the moment
  • the function _check_wallet_balance is a simple refactor (no business logic changes) it was required by the code check tools (parent function was getting too large)

image

@codecov
Copy link

codecov bot commented May 21, 2024

Codecov Report

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

Project coverage is 61.79%. Comparing base (44b458e) to head (c796540).

Files Patch % Lines
lnbits/core/services.py 41.66% 7 Missing ⚠️
lnbits/decorators.py 72.72% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2522      +/-   ##
==========================================
- Coverage   61.80%   61.79%   -0.01%     
==========================================
  Files          69       69              
  Lines        9703     9717      +14     
==========================================
+ Hits         5997     6005       +8     
- Misses       3706     3712       +6     

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

return invoice.payment_hash


def _check_wallet_balance(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this function was extracted because the parent function was getting too large and flake8 complained

@motorina0 motorina0 marked this pull request as ready for review May 21, 2024 12:42
@dni dni force-pushed the dev branch 2 times, most recently from eb41f08 to 44b458e Compare May 22, 2024 09:15
@motorina0 motorina0 force-pushed the check_payment_tag branch from 9b03c6d to c796540 Compare May 22, 2024 09:26
@motorina0 motorina0 merged commit 7c68a02 into dev May 24, 2024
@motorina0 motorina0 deleted the check_payment_tag branch May 24, 2024 14:25
motorina0 added a commit that referenced this pull request Jul 10, 2024
* feat: check if the payment is made for an extension that the user disabed
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