1
0
Commit Graph

264 Commits

Author SHA1 Message Date
SomberNight
92bdc4d4ca daemon: load_wallet: add force_check_password arg, and use it in qml
- fix: qml gui errors when trying to open a wallets with only keystore-encryption
  - fixes https://github.com/spesmilo/electrum/issues/10171
- qml gui to prompt for password on wallet open even if wallet is not storage-encrypted
2025-08-23 16:54:48 +00:00
SomberNight
9e7c332b06 lnworker: rewrite payment_bundles: lower cpu-time-complexity 2025-08-23 02:41:46 +00:00
SomberNight
8d8d1dba0f util.format_satoshis: floating-point paranoia 2025-08-22 13:30:26 +00:00
ThomasV
0949d9755c Merge pull request #10165 from spesmilo/swaps_prepayment
reverse swaps: in the CLI, replace 'server_mining_fee' with
2025-08-22 10:37:53 +02:00
ThomasV
864932c79a reverse swaps: in the CLI, replace 'server_mining_fee' with
'prepayment', which corresponds to the trusted part of the
lightning payment.

We use 2*sm.mining_fee, where 'mining_fee' is the flat part of
the server fee. However, future protocol should probably allow
to set a value that does not depend on 'mining_fee'.
(note that LND uses a hardcoded amount).
2025-08-21 19:47:00 +02:00
SomberNight
74cd2b4ac3 commands: use format_satoshis consistently. don't use sci-notation
old behaviour:
```
>>> from electrum.commands import format_satoshis
>>> format_satoshis(1)
'1E-8'
```
2025-08-21 17:38:27 +00:00
ThomasV
07d69bd876 Merge pull request #10161 from spesmilo/txbatcher_do_not_remove_local_tx
txbatcher: be careful when removing local transactions
2025-08-21 19:10:49 +02:00
f321x
990a56b9dc tests: regtest: add swapserver mining fee argument 2025-08-21 14:23:26 +02:00
f321x
8c8d142307 tests: unittest get_submarine_swap_providers cli 2025-08-21 14:23:24 +02:00
ThomasV
5f30f2a0c0 txbatcher: be careful when removing local transactions
1. Do not remove local transaction in find_base_tx.

This logic was intended to cleanup claim transactions that are
never broadcast (for example, if the counterparty gets a refund)
(see 1bf1de36cb)

However, this code is too unspecific and may result in fund loss,
because the transaction being removed may contain outgoing payments.
For example, if the electrum server is not responsive, the tx will
be seen as local and deleted. In that case, another payment will
be attempted, thus paying twice.

2. Do not remove tx after try_broadcasting returns False.

The server might be lying to us. We can only remove the local tx
if there is a base_tx, because the next tx we create will try to
spend the same output.
2025-08-21 10:26:35 +02:00
ghost43
8feaa4bb66 Merge pull request #10141 from SomberNight/202508_kswizard_multisig
wizard: enable_keystore: fix for multisig
2025-08-18 14:27:45 +00:00
SomberNight
2318cf7369 keystore: Old_KeyStore: fix check_password(None) if ks has password
check_password(None) should raise InvalidPassword when called on a keystore that has a password.

regression from f86bdc86a2

fixes https://github.com/spesmilo/electrum/issues/10142
2025-08-16 18:08:10 +00:00
SomberNight
dc999aa948 wizard: enable_keystore: fix for multisig
regression from 66c0fec1ea
2025-08-15 20:52:49 +00:00
SomberNight
14494c13dc qt wizard: start: merge "start_viewstate" and "initial_data" 2025-08-15 20:46:24 +00:00
SomberNight
43987c5ca0 wizard: make start() kwarg-only
I want to see where initial_data arg is actually set from.
Looks like hardly anywhere(?)
It is really hard to see because the wizard is crazy-dynamic, there's polymorphism and mixins everywhere.
2025-08-15 20:35:29 +00:00
ghost43
8a8ab26d44 Merge pull request #10140 from SomberNight/202508_test_keystore_wizard
wallet: enable/disable_keystore: some more fixes and tests
2025-08-15 18:16:38 +00:00
SomberNight
5997494c46 tests: wizard: add test "adding unrelated seed to xpub-only ks raises" 2025-08-15 17:39:57 +00:00
SomberNight
cd63be233b wallet: disable_keystore() not to destroy get_key_origin_info() 2025-08-15 17:29:55 +00:00
SomberNight
f025a75356 tests: wizard: use real bip39 seeds 2025-08-15 17:19:22 +00:00
SomberNight
0ceb54b61f wallet: enable/disable_keystore: rm functionality from 2fa wallets
was already not working, but does not even really make sense without larger changes
2025-08-15 16:18:13 +00:00
ghost43
1ae3d0a0bf Merge pull request #10131 from SomberNight/202508_commands_onchain_history
commands: add back from_height/to_height params to onchain_history
2025-08-15 13:36:25 +00:00
ghost43
5a9f54fba0 Merge pull request #10133 from f321x/qml_timestamp_precision
qml: reduce tx history timestamp precision
2025-08-14 17:26:08 +00:00
SomberNight
0fea61ac3a tests: wizard: KeystoreWizard: also test disable_keystore() 2025-08-14 17:06:52 +00:00
SomberNight
6554ec674e tests: wizard: KeystoreWizard: add test case for old seed 2025-08-14 16:44:57 +00:00
SomberNight
e3d1c6aefd wallet: enable/disable_keystore: trivial clean-up 2025-08-14 16:16:31 +00:00
SomberNight
34f0450798 tests: commands: onchain_history: add test for "show_fiat" param 2025-08-14 15:26:59 +00:00
f321x
292ade8953 tests: unittest QETransactionListModel date format
adds unittests for the date formatting and categorization in
QETransactionListModel
2025-08-14 10:10:42 +02:00
SomberNight
d7c76b991b commands: add back from_height/to_height params to onchain_history
closes https://github.com/spesmilo/electrum/issues/10119

also:
- wallet.get_onchain_history was broken with from_height/to_height args
- "show_fees" param is and was non-existent. fees are always added to output
- MyEncoder(json.JSONEncoder) changed a bit:
  - I am pretty sure cutting the last 3 chars was intended to cut off the seconds
  - however that was making incorrect assumptions about what datetime.isoformat() returns
    - which depends on whether microsecond precision is available or whether an explicit timezone is set
  - this now makes it clear that we want minutes-resolution, but still leaves the timezone-ambiguity
2025-08-13 15:09:04 +00:00
Sander van Grieken
e1d5d803e9 wizard: fix missing 'wallet_password' and 'wallet_password_hardware' views on abstract KeystoreWizard
(these were implicitly defined by the Qt subclass) and test wallet keystore enable.
2025-08-13 16:25:01 +02:00
Sander van Grieken
0c5403b91e wizard: add initial tests for KeystoreWizard for electrum and bip39 seeds, hww 2025-08-13 14:40:18 +02:00
SomberNight
acc52e392c tests: wizard: imported addrs: validate each addr with "is_address()"
This was already done *in the GUIs*, but the backend should definitely
do at least sanity-check-level validation like this.
2025-08-12 18:42:35 +00:00
SomberNight
19b2567da8 tests: bitcoin: merge testnet/mainnet address_to_script tests
and add an extra explicit mixed-case bech32 test case
2025-08-12 18:28:09 +00:00
SomberNight
dad18c030c tests: wizard: add test cases for imported wallets 2025-08-12 17:47:03 +00:00
SomberNight
d78782c6ae tests: wizard: add test cases for multisig 2025-08-12 15:44:28 +00:00
SomberNight
fe3ebb31ec tests: wizard: add test case for "restore from slip39" 2025-08-12 15:43:17 +00:00
SomberNight
30a646f80a tests: wizard: add test case for "restore from xpub" 2025-08-12 15:41:31 +00:00
ghost43
186b8ec2ab Merge pull request #10111 from SomberNight/202508_iface_cache_broadcast_tx
interface: don't request same tx from server that we just broadcast to it
2025-08-08 17:28:34 +00:00
SomberNight
4f1cc8b9cb tests: set low wallet.gap_limit_for_change to speed up tests 2025-08-08 16:36:39 +00:00
SomberNight
98c4c9709f tests: interface: more aggressive clean-up 2025-08-08 14:35:03 +00:00
SomberNight
cd8bbcd2bb tests: don't block forever if a prior unit test raised during setUp 2025-08-08 14:35:00 +00:00
SomberNight
05da50178b interface: don't request same tx from server that we just broadcast to it
Often when the wallet creates a tx, the flow is:
- create unsigned tx
- sign tx
- broadcast tx, but don't save it in history
- server sends notification that status of a subscribed address changed
- client calls scripthash.get_history
- client sees txid in scripthash.get_history response
- client calls blockchain.transaction.get to request missing tx

Instead, now when we broadcast a tx on an interface, we cache that tx *for that interface*,
and just before calling blockchain.transaction.get, we lookup in the cache.
Hence this will often save a network request.
2025-08-08 14:34:56 +00:00
SomberNight
d47f38b0e0 tests: interface: impl get_tx/broadcast_tx for electrum server 2025-08-08 14:34:46 +00:00
SomberNight
8efc2aab5e tests: interface: implement toy electrum server 2025-08-08 14:33:38 +00:00
ghost43
4684cdbd17 Merge pull request #10067 from f321x/max_cltv_lnpay
cli: add max_cltv, max_fee_msat parameters to lnpay
2025-08-01 15:14:44 +00:00
SomberNight
6ddc975a94 follow-up prev: clean-up PaymentFeeBudget API 2025-08-01 15:06:33 +00:00
SomberNight
60eb437f99 tests: commands: fix assertRaises in test_hold_invoice_commands 2025-08-01 14:41:28 +00:00
ghost43
c23cc29caa Merge pull request #10082 from f321x/check_hold_invoice_show_htlc_cltv
cli: return closest htlc expiry from check_hold_invoice
2025-08-01 14:29:24 +00:00
f321x
23a48e7cfd test: add unittest for not spending ln reserve utxo
adds unittest to `test_wallet_vertical.py` to verify it is not using the
existing ln reserve utxo as tx input if a reserve is still required (in
opposite to using it as input and creating a new reserve as output).
2025-07-30 10:12:34 +02:00
f321x
6425f9bf75 cli: return closest htlc expiry from check_hold_invoice
Adds a `closest_htlc_expiry_height` value to the `check_hold_invoice` cli command response.
This allows to see the next absolute expiry height of the pending htlcs
of a payment. Note, htlcs will get failed before the actual expiry
height (if block_height + 144 > htlc.cltv_abs).
2025-07-25 11:44:26 +02:00
ghost43
8eb3c43603 Merge pull request #10059 from f321x/fix_issue_10057
fix: cli: check_hold_invoice showing settled invoice as unpaid
2025-07-21 15:53:54 +00:00