1
0
Commit Graph

18907 Commits

Author SHA1 Message Date
наб
8da694c9c3 history_list: pre-compute sort keys, don't launder getting them through get_data_for_role()
endInsertRows() triggers a sort, the history sort/filter proxy model
then launders the comparison requests through get_data_for_role()
with a custom key, which is then especially looked up in there,
but custom-flattened in the proxy model. This is OO hell

Measuring refresh() from after if transactions == self.transactions: return
to the final return, sorting the wallet from #9958/#6625 takes ~3.5s
and 132348 get_data_for_role() calls

Beside that get_data_for_role() is called maybe 10 times per on-hover?
It's immaterial

Thus: compute the sorting keys when constructing the HistoryNode
and use them directly in the comparison.
This decouples get_data_for_role() from the sorter
and speeds the sort up by ~2x,
now being mostly made up of the python interpreter overhead(?)
for upcalls to lessThan()

A dict wins with a list for the lookup a tiny bit
(and is 100x better code-wise):

1.896097298245877s list
1.840533264912665s list
1.757185084745288s list
1.8990754359401762s list
1.914668960031122s list
1.9349112827330828s list
2.432649422902614s list
1.929884395096451s list
1.9610795709304512s list
1.8694845158606768s list
1.9600030612200499s list
1.9199693519622087s dict
2.0466488380916417s dict
1.8510140180587769s dict
1.8978681536391377s dict
2.0079748439602554s dict
1.9111531740054488s dict
1.9525738609954715s dict
1.850804285146296s dict
1.860573346260935s dict
1.95173170696944s dict
1.8481200002133846s dict

Benchmark 1: dict
  Time (mean ± σ):       1918.039234 ms ±    63.688609 ms
  Range (min … max):     1848.120000 ms …  2046.648838 ms    11 runs

Benchmark 2: list
  Time (mean ± σ):       1945.052027 ms ±   164.019588 ms
  Range (min … max):     1757.185085 ms …  2432.649423 ms    11 runs

Summary
  'dict' ran
    1.014084 ± 0.090082 times faster than 'list'
2025-07-01 03:32:42 +02:00
SomberNight
61623d6d56 daemon lockfile: if create_time is in the future, don't wait for it :D
- if Electrum cannot do a graceful shutdown, the daemon lockfile won't get cleaned up
- the daemon lockfile contains the creation time of the daemon
- then, especially for an always offline phone/laptop, if the battery dies, the clock
  might go back to the past
- the bug: next time Electrum starts, the program will wait until create_time + 1.0
  before giving up on the daemon and creating a new one

closes https://github.com/spesmilo/electrum/issues/9802
  - certainly fixes at least https://github.com/spesmilo/electrum/issues/9802#issuecomment-3020220593
  - the OP there might or might not be the same issue
closes https://github.com/spesmilo/electrum/issues/9529
  - same here, might or might not be the same issue

the logic bug is quite old, from e6020975a5
2025-06-30 22:36:49 +00:00
ghost43
5cb844fc7c Merge pull request #9945 from f321x/osx_sign_self_signed_cert
build-osx: add docs for testing with self-signed certificate
2025-06-30 14:08:05 +00:00
SomberNight
60bb425ed6 follow-up prev: add explanation 2025-06-30 14:05:21 +00:00
ghost43
1c014a7c85 Merge pull request #9967 from nabijaczleweli/hors-d'oeuvres
Populate tx_status_cache before it's used, not after. Only compute short_id when requested
2025-06-30 13:55:41 +00:00
ghost43
96a636d578 Merge pull request #9998 from f321x/hold_invoice_cli_hash
cli: use payment hash for hold invoice creation
2025-06-30 13:42:15 +00:00
Sander van Grieken
39c0523773 qml: only save invoice if canSave 2025-06-30 12:56:22 +02:00
f321x
389a0a6e91 cli: use payment hash for add_hold_invoice
Allowing to create hold invoices just by providing a payment hash
instead of the preimage right from the beginning allows for additional
use cases where the recipient doesn't have access to the preimage when
creating the invoice.
2025-06-30 09:34:05 +02:00
SomberNight
10e3bad884 qml: qeinvoice: don't use wallet.get_balance() for NotEnoughFunds checks
related https://github.com/spesmilo/electrum/issues/8835
2025-06-29 22:59:30 +00:00
SomberNight
ba670cc9dc wallet: add struct PiechartBalance 2025-06-29 22:25:56 +00:00
ghost43
405197b9ae Merge pull request #9995 from cloudclaim/master
chore: fix some minor issues in the comments
2025-06-29 14:06:26 +00:00
cloudclaim
06d1b730b7 chore: fix some minor issues in the comments
Signed-off-by: cloudclaim <824973921@qq.com>
2025-06-29 10:07:38 +08:00
SomberNight
0e4b3a3d58 commands: add comment about "timeout" args
really is black magic
2025-06-28 10:02:40 +00:00
SomberNight
50d48aee2d fee_policy: move regtest fallback even deeper 2025-06-28 04:29:50 +00:00
SomberNight
848e605a80 fee_policy: instead of checking has_data, handle "eta_to_fee() is None" 2025-06-28 04:10:38 +00:00
SomberNight
92bdf70c73 fee_policy: separate fallback static fee vs regtest hardcoded fee 2025-06-28 04:10:35 +00:00
SomberNight
ae70d204b0 daemon: should only log "Ignoring -w" for "daemon" command, not for gui 2025-06-28 03:17:27 +00:00
SomberNight
588363749c commands: fix convert_currency cmd 2025-06-27 15:15:12 +00:00
ghost43
ce64dea0a1 Merge pull request #9990 from f321x/payment_sent_colon
qt: remove colon in "Payment received:" notification
2025-06-27 11:15:14 +00:00
ghost43
bde2e23ca3 Merge pull request #9989 from f321x/swap_dialog_followup
qt: SwapDialog: update on changes, don't translate f-str
2025-06-27 11:13:43 +00:00
f321x
a50c088c4b qt: remove colon in "Payment received" notification
if there is no amount in the payment request the notification would look
weird as it would just show `Payment received:` indicating something
might be missing. Now it just says `Payment received` instead.
2025-06-27 12:49:12 +02:00
f321x
73249404d4 qt: SwapDialog: update on changes, don't translate fstr
and differenciate between a single 'provider' and multiple or 0
'providers'. Also update SwapDialog and SwapServerDialog
when new offers are incoming. Stops translating f-string.
2025-06-27 11:18:38 +02:00
ghost43
3f755e19a4 Merge pull request #9988 from SomberNight/202506_txbatcher_cleanup
txbatcher: add type-hints
2025-06-26 14:31:17 +00:00
SomberNight
2b92e8a97a txbatcher: add type-hints 2025-06-26 14:10:18 +00:00
ghost43
c2b99f08be Merge pull request #9977 from SomberNight/202506_qt_qrtextedit_rm_dupe
qt: qrtextedit: rm some duplication
2025-06-26 13:56:14 +00:00
ThomasV
56684c049a follow-up 2119bf2b23 2025-06-26 14:46:08 +02:00
ThomasV
2119bf2b23 Qt swaps_dialog: update send/recv amounts after changing provider.
Also, show current provider color icon in button
2025-06-26 14:20:12 +02:00
SomberNight
84cdbc930b commands: list_channels: include "closing_txid"
want to use this in regtests
2025-06-25 17:15:55 +00:00
SomberNight
b590c864ee config: fix setting CLI_TIMEOUT configvar, and add "convert_setter"s
"type_=float" behaves a bit weirdly. Was kinda broken before, still not fully "fixed" here.
With this commit, if used together with convert_setter, it at least behaves in a sane way.

```
$ ./run_electrum -o setconfig timeout 10
  1.16 | E | __main__ | error running command (without daemon)
Traceback (most recent call last):
  File "/home/user/wspace/electrum/./run_electrum", line 593, in handle_cmd
    result = fut.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/home/user/wspace/electrum/./run_electrum", line 268, in run_offline_command
    result = await func(*args, **kwargs)
  File "/home/user/wspace/electrum/electrum/commands.py", line 194, in func_wrapper
    return await func(*args, **kwargs)
  File "/home/user/wspace/electrum/electrum/commands.py", line 408, in setconfig
    self._setconfig(key, value)
  File "/home/user/wspace/electrum/electrum/commands.py", line 398, in _setconfig
    cv.set(value)
  File "/home/user/wspace/electrum/electrum/simple_config.py", line 126, in set
    self._config_var._set_config_value(self._config, value, save=save)
  File "/home/user/wspace/electrum/electrum/simple_config.py", line 89, in _set_config_value
    raise ValueError(
ValueError: ConfigVar.set type-check failed. key='timeout'. type=<class 'float'>. value=10
```
2025-06-25 17:15:52 +00:00
SomberNight
fa0921e33b tests: regtest: add comments to swapserver tests 2025-06-25 17:15:47 +00:00
SomberNight
aeba531aa8 logging: keep more log files by default
To reduce chance an important log file gets lost due to the user restarting the app a couple times.
Perhaps we should make this smarter and cap based on bytes size of folder, instead of number of files.
2025-06-25 16:46:16 +00:00
наб
663900270c Only compute short_id when requested 2025-06-25 17:11:32 +02:00
наб
60cb94f845 Populate tx_status_cache before it's used, not after
The endInsertRows() call triggers the main calls to get_data_for_role():
in the current order, the try/except goes to the exception every time

In the updated order, it doesn't do it ever

We have full control over what's in the cache,
and we always fully populate it, so we can get rid of the fallback
2025-06-25 17:11:32 +02:00
accumulator
26e6c0900b Merge pull request #9975 from SomberNight/202506_qml_lnurl_btn_disabled
qml: set BtcField.textAsSats initial value to match its text
2025-06-24 12:54:19 +02:00
ghost43
c7b740847c Merge pull request #9978 from f321x/qml_swapserver_ordering
fix: sort qml swap provider list by PoW
2025-06-24 10:35:17 +00:00
f321x
f1837ef58d fix: sort qml swap provider list by PoW
This change orders the list of swapproviders in the qml gui by the
`pow_bits` value in the announcement by inserting the orders at the
correct index in the list instead of just appending new incoming offers.
2025-06-24 11:45:34 +02:00
SomberNight
71627b91c4 qml: set BtcField.textAsSats initial value to match its text
textAsSats was being set to 0 initially, regardless of actual text, only healing after onTextChanged.

fixes https://github.com/spesmilo/electrum/issues/9974
2025-06-24 09:19:13 +00:00
SomberNight
5ea614c81a qt: qrtextedit: rm some duplication
There was too much code duplication - there still is a bit...

- in some places buttons had text "Read QR code with camera", in others it was "Read QR code from camera"
- 63c224cb53 added a "on_qr_from_file_input_btn"
  input method, which was not added everywhere.
  - was missing in add_qr_input_combined_button and in editor_contextMenuEvent
2025-06-23 16:10:14 +00:00
SomberNight
6f5041443f qt: SwapServerDialog: explicit columns 2025-06-23 14:49:36 +00:00
ghost43
0c0a8b7c82 Merge pull request #9955 from SomberNight/202506_qt_mac_camera_permission
qt gui: qrreader: macos: add runtime requesting of camera permission
2025-06-23 14:21:52 +00:00
SomberNight
c1d21aab1d qml: QENetwork: reduce log spam a bit in ln-gossip mode 2025-06-23 13:10:44 +00:00
ThomasV
b79a73b483 qt swaps dialog: replace config menu with a direct button 2025-06-21 10:46:33 +02:00
ThomasV
2607a0d9f6 Plugins dialog: remove direct download option.
Since users have to trust plugin publishers, we should expect
the plugin to be signed by its author, and the user to verify
the signature before installing.
2025-06-21 10:10:31 +02:00
ThomasV
d7f6820fd6 hardware_wallets: register keystore if if external plugin was authorized
Also remove 'gui_good' from hw_wallets dict (was always True)
2025-06-19 11:23:57 +02:00
ThomasV
f6075a5825 follow-up ba3783f998 2025-06-19 09:44:56 +02:00
ThomasV
4714fdfba2 plugins: add icons to manifest.json 2025-06-17 10:45:03 +02:00
accumulator
96ea80a8a1 Merge pull request #9959 from accumulator/nostr_swap_server_wait_unlock
submarine_swaps: wait for unlock if wallet is password protected before starting nostr swap service
2025-06-16 16:14:36 +02:00
accumulator
998e9a5f48 Merge pull request #9966 from f321x/improve_windows_installer_safety
block windows installer if Electrum is still running
2025-06-16 16:08:31 +02:00
f321x
ddddaad9a1 block windows installer if Electrum is still running
Adds a check to the Windows nsis installer and uninstaller
that will show an error popup if Electrum is still running to prevent
a broken installation that happen if the installer only partly
overwrites the existing installation (see #6748).
This works by trying to open the .exe files in the Electrum installation
directory in append mode, if Electrum is still running the installer
will not be able to open the .exe and the check fails.
Based on https://github.com/Electron-Cash/Electron-Cash/pull/2185
2025-06-16 15:08:22 +02:00
ghost43
a8b8359943 Merge pull request #9963 from f321x/fix_wine_unsign
fix: make build-wine/unsign.sh fail if osslsigncode is missing
2025-06-16 13:04:26 +00:00