1
0
Commit Graph

21 Commits

Author SHA1 Message Date
SomberNight
a19e14bc2c wallet.get_tx_status: fix incorrect feerate for partial txs
The history tab would show an incorrect feerate for partial/unsigned (local) txs,
if they had any p2sh/p2wsh txins. We would just guess the script is p2wpkh, and
use that for the size calc. Now with calling add_info_from_wallet, the correct
size is used to calculate the feerate.

(The gui tx dialogs call add_info_from_wallet independently, so the size/feerate
shown there were already correct.)
2024-10-14 15:18:33 +00:00
SomberNight
546d570ca2 util.error_text_str_to_safe_str: truncate long errors
The messages are sometimes logged and sometimes shown to the user,
- for logging we might not want to truncate or have higher limits,
- but when shown to the user, we definitely want to truncate the error text.
It is simplest to just do the truncation here, at the lowest level.

Note that we usually prepend the error text with a header e.g. "[DO NOT TRUST THIS MESSAGE]"
and if the error text is too long, this header at the beginning might get "lost" in some way.
Hence we should truncate the error text.
2024-10-14 15:13:01 +00:00
SomberNight
cb4539c73f mnemonic: rename seed_type() fn
Some functions have an argument named "seed_type" in which it was annoying to call the seed_type() fn.
(especially for functions inside the same module)
2024-10-14 15:11:43 +00:00
SomberNight
d6006b0942 soothe flake8
```
./tests/test_mnemonic.py:249:9: B017 `assertRaises(Exception)` and `pytest.raises(Exception)` should be considered evil. They can lead to your test passing even if the code being tested is never executed due to a typo. Assert for a more specific exception (builtin or custom), or use `assertRaisesRegex` (if using `assertRaises`), or add the `match` keyword argument (if using `pytest.raises`), or use the context manager form with a target.
        with self.assertRaises(Exception):
        ^
1     B017 `assertRaises(Exception)` and `pytest.raises(Exception)` should be considered evil. They can lead to your test passing even if the code being tested is never executed due to a typo. Assert for a more specific exception (builtin or custom), or use `assertRaisesRegex` (if using `assertRaises`), or add the `match` keyword argument (if using `pytest.raises`), or use the context manager form with a target.
```
2024-10-14 15:10:17 +00:00
SomberNight
8def0bd6c2 wizard: fix regression: allow passphrase for some '2fa' seeds
fixes https://github.com/spesmilo/electrum/issues/9088
2024-10-14 15:08:07 +00:00
SomberNight
abea2bb268 tests: wallet_vertical: re pre-2.7 "2fa" seeds, test both 24 and 25 len 2024-10-14 15:07:33 +00:00
SomberNight
7e29214219 daemon error-handling: fix traceback.format_exception() on old python
The new API for traceback.format_exception was only added in python 3.10 (91e93794d5).
2024-10-14 15:00:10 +00:00
Sander van Grieken
8e240f4de7 bip21: add testcases for amount bounds 2024-05-29 15:35:26 +02:00
Ondřej Vejpustek
a1f7241490 slip39: implement extendable backups 2024-05-27 14:39:30 +00:00
SomberNight
24426fd54a lnworker: make PaymentFeeBudget defaults configurable
- make PaymentFeeBudget proportional fee and flat cutoff fee configurable
  - closes https://github.com/spesmilo/electrum/issues/7622
- increase flat cutoff fee default to 10 sat
  - closes https://github.com/spesmilo/electrum/issues/7669
- rm RouteEdge.is_sane_to_use() (per edge limit) and just rely on budgets (per route limit)
2024-05-27 14:32:10 +00:00
SomberNight
c9ed717bea dependencies: remove bitstring
- `bitstring` started depending on `bitarray` in version 4.1 [0]
  - that would mean one additional dependency for us (from yet another maintainer), which is not even pure python
- we only use bitstring for bolt11-parsing
- hence this PR rewrites the bolt11-parsing and removes `bitstring` as dependency
- note: I benchmarked lndecode using [1], and the new code performs better,
  taking around 80% time needed for old code (when using bitstring 3.1.9, pure python).
  Though the variance is quite large in both cases.

[0]: 95ee533ee4/release_notes.txt (L108)
[1]: d7597d96d0
2024-05-27 14:24:45 +00:00
ThomasV
bd32ebecb2 test_lnpeer: fix node_id in storage of created peers 2024-05-27 14:19:21 +00:00
SomberNight
30c9f5b6b1 walletdb: chan dict: small clean-up (incl db upgrade)
- "fail_htlc_reasons" was removed in 9b1c40e396
- "unfulfilled_htlcs": rm 2 dead items from the 4-tuple,
   and convert False value of forwarding_key
2024-03-01 16:28:46 +00:00
ThomasV
94a8754bdd regtest: test swapserver with trampoline onions 2024-03-01 12:00:24 +01:00
SomberNight
51b7fc04ef walletdb: fix convert_version_58 for partial local txs
The transaction dict can also contain PSBTs (in addition to complete raw hex txs).
This is the case if the user has saved a partial (e.g. unsigned) tx as local into the history.

fixes https://github.com/spesmilo/electrum/issues/8913
2024-02-26 18:54:21 +00:00
SomberNight
d01582d58c fix tests (follow-up)
follow-up 197979063a
2024-02-22 12:26:25 +00:00
ThomasV
32775c1b5d regtest: fix varname in wait_until_htlcs_settled
(this was not affecting the tests)
2024-02-22 09:40:59 +01:00
SomberNight
8ab3dcce5d keystore: API changes for from_seed/from_bip43_rootseed/bip39_to_seed
- force kwargs
- add type hints
2024-02-21 15:08:19 +00:00
Sander van Grieken
6ecbb8eb3f tests: add test for payment_identifier.invoice_from_payment_identifier() 2024-02-19 11:54:32 +01:00
Sander van Grieken
0faf6928c0 tests: explicit sync on self.app instance ready and make sure _testcase_event is cleared before
QMetaObject.invokeMethod as that can race if it gets inadvertently executed synchronously.
2024-02-16 16:56:14 +01:00
Sander van Grieken
73fee69f5c tests: move /electrum/tests to /tests 2024-02-16 15:40:45 +01:00