* [FIX] workflows
testing why workflwos unstable instable
* debug run_command
* add timeout to process run
* log lncli output
* try catch json exception in clnrest
* settle does not return a json
* add 10 minutes timeout to regtests if they ever get stuck
* better subprocess handling
* fix race condition
* test 3
* remove
* run nr 4
* increase waits for race conditions
* revert clnrest
* better fiat amount test
* save fiat_amounts on payment creation
* show fiat amount in frontend
* add lnbits_default_accounting_currency
* extract fiat calculation logic into service
* move all currency conversions to calc_fiat_amounts
move all conversion logic into create_invoice so extensions can benefit aswell
* show user-defined and wallet-defined currency in frontend
* remove sat from fiat units
* make bundle
* improve tests
* debug log
* replace async_wrap with run_sync
formatting
remove unused fn
properly raise exception, not for timeout though
* [TEST] proper startup and shutdown (#1860)
* add proper startup / shutdown in tests
* fix event loop issues
because uvloop was installed in server.py which is not the main entry point when tests are ran.
this caused the loops referenced by the locks and queues to be a different one than the one used to run the tests
(only an issue in python 3.9)
* give openapi more time, does not matter anyway, regtest takes way longer
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
remove uvloop
* fix test
* dont touch pyproject
* fix: install uvloop in conftest
not using uvloop at all causes tests to take way longer
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
* [CHORE] cleanup cache and exception on `make test`
moved the invalidate_forever task to proper location and use `create_permanent_task`.
and there was a Task never awaited Exception when running tests
* imrpove expiration test
* move cache into utils
* fix issue with pytest_asyncio
s
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
* simplify and cache exchange rate
note that exir was removed as a provider
* add binance as provider
* log exception
* add test
* add blockchain.com provider
* [CHORE] update mypy and new issues
lnbits/cache.py:21: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/extension_manager.py:210: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/db.py:110: error: Only instance methods can be decorated with @property [misc]
lnbits/tasks.py:152: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/tasks.py:171: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/core/services.py:520: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/app.py:520: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/app.py:525: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/app.py:532: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
* fix db.py
* fix mypy notes, type were not needed
* [REFACTOR] WalletType into enum
- move wallettype models from decorators.py into models.py
- use enum instead of int
- use HTTPStatus for consistency
* Update lnbits/core/models.py
Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
* use dataclass
---------
Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
* remove unused and update black + precommit
* makefile add ruff remove unused
* F541 fix
* complete ruff ignore
* remove unused workflow and combine linters into one
add lnbits/static to ruff ignore
save preview and linelength for later
define target version for black
* ignore upgrades for mypy
* remove flake8
* ignore F401 for __init__ files
* unused pylint comment
* unused noqa
* ignore upgrades for black
* run linting on py3.9 and py3.10
* dont assume python
* add centralized task management
in order to properly cleanup all long-running tasks we have to keep a list of them
* use new task management functions
* unify shutdown events
* vlads suggestions
rename variable for create_task
wrap cancel() with try/catch
fixup
* rename func to coro
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
* [refactor] pyln-client is not optional
some time ago we added pyln do main dependencies, its need for think like, saas or docker.
so this import was dead code
* stubs for pyln.client
* F821: undefine name
disabled and logged webhook_listener for opennode and lnpay because they are obviously not working
* E402: module level import not at top of file
* E721 fixes, only popped up for python3.9 not 3.10
* add simple caching utility
* test cache
* remove prefix, default on get
* check expiry in pop aswell
* remove unnecessary type
* improve invalidation task
increase default interval to 10 seconds - doesnt have to check that often.
instead of recreating the dict everytime mutate the existing one
* tests: hold invoice tests pending during payment
* sigh...
* ok
* hash preimage
* preimage_hash == payment_hash
* should error
* check that payment is gone
* cancel task while in-flight
* lnbits endpoing return error
* return error
* add both options
* fix list
* respond to error
* return false if payment status errors
* outgoing invoice should be deleted after one status check
* test api_payments_create error
* add hold invoices and basic test
* run request in parallel
* create_task
* dont cancel it
---------
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
* add send_payment_notification service
payment notifications are sent from multiple places with inconsistent and incomplete data
* adopt new send_payment_notification service
* add tests