Commit Graph

1337 Commits

Author SHA1 Message Date
ThomasV
9a5496cfd8 Qt: remove redundant history_list update 2023-02-20 10:06:26 +01:00
SomberNight
373db76ac9 util: kill bh2u
no longer useful, and the name is so confusing...
2023-02-17 11:43:11 +00:00
ThomasV
292ce35945 receive tab: copy to clipboard when tab is changed 2023-02-13 11:20:10 +01:00
ThomasV
1da65451c0 Qt: schedule tooltip in do_copy 2023-02-13 11:11:26 +01:00
ThomasV
4a91213044 minor fix 2023-02-12 13:28:19 +01:00
ThomasV
d766f2fd9e Qt: make copy menus more consistent 2023-02-12 11:13:03 +01:00
ThomasV
df842af0b6 UTXO tab: add menus to fully spend utxo:
- send to address
 - in new channel
 - in submarine swap

This is easier than coin control, because it does not involve
switching tabs. Coin control is activated during the operation,
so that users learn how it works.
2023-02-11 10:49:33 +01:00
ThomasV
215629235d submarine_swaps: fix bugs and create method for max_amount_forward_swap 2023-02-11 10:21:01 +01:00
ThomasV
d7f48c8805 Qt history tab: create submenu for edit actions 2023-02-10 17:13:02 +01:00
ThomasV
f617887509 RBF dialog: do not decrease payment for swap funding transactions. 2023-02-10 16:30:08 +01:00
ThomasV
965ccedc88 tx dialog clean-up: remove 'finalized' field and related code 2023-02-10 13:02:58 +01:00
ThomasV
d1eb909bee UTXO tab: simplify freeze menus 2023-02-10 10:35:13 +01:00
ThomasV
bf16919a74 Merge pull request #8197 from spesmilo/new_tx_flow
Qt: new onchain tx creation flow:
2023-02-10 10:26:44 +01:00
ThomasV
a4928ea6ed TxEditor: various tweaks 2023-02-09 14:58:57 +01:00
ThomasV
ad83eaaba1 TxEditor: rework update methods, separate _update_message from _update_send_button 2023-02-09 14:21:03 +01:00
ThomasV
13222c479c TxEditor: make trigger_update not private, call it on rbf combo changed. 2023-02-09 11:29:10 +01:00
ThomasV
a740a8a004 TxEditor: move set_locktime 2023-02-09 11:15:31 +01:00
ThomasV
95433cd153 TxEditor: update_extra_fees, overloaded by ConfirmTxDialog 2023-02-09 11:07:37 +01:00
ThomasV
8c00188348 TxEditor: set locktime 2023-02-09 10:52:09 +01:00
SomberNight
227ccc65d4 perf: load matplotlib on-demand
it takes ~1.7 seconds to import electrum.plot, slowing down app-startup considerably
2023-02-08 23:37:11 +00:00
ThomasV
1d00b56b64 make ConfirmTxDialog resizeable 2023-02-08 13:28:03 +01:00
ThomasV
53b7cc3f90 use shared prefix for config keys related to tx editor 2023-02-08 11:34:48 +01:00
ThomasV
6e8e8798c7 feerounding_icon: use transparent background, and disable if not visible 2023-02-08 11:22:02 +01:00
SomberNight
1e3f9b942f qt: MyTreeView.refresh_all to use maybe_defer_update
In particular, window.timer_actions() calls
request_list.refresh_all() and invoice_list.refresh_all(),
every 0.5 seconds.
We avoid doing this at least when those lists are not visible anyway.
2023-02-08 00:45:18 +00:00
ThomasV
bc3946d2f4 Qt: new onchain tx creation flow:
- transaction_dialog is read-only
 - ConfirmTxDialog and RBF dialogs inherit from TxEditor
 - TxEditors are configurable
2023-02-07 16:42:20 +01:00
SomberNight
b4d2c902c4 qt tx dialog: fix for pre-segwit legacy wallets
```
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/invoice_list.py", line 169, in <lambda>
    menu.addAction(_("Pay") + "...", lambda: self.send_tab.do_pay_invoice(invoice))
  File "/home/user/wspace/electrum/electrum/gui/qt/send_tab.py", line 585, in do_pay_invoice
    self.pay_onchain_dialog(self.window.get_coins(), invoice.outputs)
  File "/home/user/wspace/electrum/electrum/gui/qt/send_tab.py", line 271, in pay_onchain_dialog
    preview_dlg = PreviewTxDialog(
  File "/home/user/wspace/electrum/electrum/gui/qt/transaction_dialog.py", line 962, in __init__
    self.update()
  File "/home/user/wspace/electrum/electrum/gui/qt/transaction_dialog.py", line 658, in update
    self.io_widget.update(self.tx)
  File "/home/user/wspace/electrum/electrum/gui/qt/transaction_dialog.py", line 212, in update
    tx_height, tx_pos = self.wallet.adb.get_txpos(self.tx.txid())
  File "/home/user/wspace/electrum/electrum/address_synchronizer.py", line 483, in get_txpos
    verified_tx_mined_info = self.db.get_verified_tx(tx_hash)
  File "/home/user/wspace/electrum/electrum/json_db.py", line 44, in wrapper
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1256, in get_verified_tx
    assert isinstance(txid, str)
AssertionError
```
2023-02-03 16:10:03 +00:00
SomberNight
b9f4758853 qt tx dialog: add "Copy Outpoint" to both IO ctx menus 2023-02-03 16:09:59 +00:00
SomberNight
3dadfadcab qt tx dialog: readd "insert_tx_io" code-factorisation recently rm-ed
follow-up 7d42676785
2023-02-03 15:50:16 +00:00
SomberNight
6ae105ca99 qt tx dialog: fix size of IO textedits when resizing
textedit.setMinimumWidth(950) (from 5af399d19639b0c141398db964270c4974f124acdoes) does not play well with the tx_dlg.setMinimumWidth(640)
when resizing. Make 950 only affect the default sizing of the textedit.
2023-02-03 15:17:42 +00:00
SomberNight
c2c02391a2 qt tx dialog: add context menus to IO fields
based on:
46df4190c8
2023-02-03 14:49:04 +00:00
SomberNight
7d42676785 qt tx dialog: make scid and addr texts clickable in IO fields
based on:
7eea0b6dae
52d845017c
2023-02-03 14:49:01 +00:00
SomberNight
53ca75d878 qt AddressDialog: separate parent and window 2023-02-03 14:48:57 +00:00
ThomasV
5af399d196 transaction_dialog: move tx in/out widgets into own class
- this widget will be used in various dialogs
- making this change now will prevent downstream conflicts
- the part that displays "coin selection active" was commented out
2023-02-03 12:33:24 +01:00
ThomasV
96ac199f5c minor fix; follow-up d6febb5c12 2023-02-03 10:45:14 +01:00
SomberNight
dbd2e56e85 qt gui: more resilient startup
Example log:
app tries to auto-open to wallet "test_segwit_2", which has too new db version,
then user manually tries to open wallet "test_segwit_3" instead,
which opens okay but - immediately after - the process shuts down (due to line 383 -> line 458).
```
$ ./run_electrum -v --testnet -o
  0.59 | I | simple_config.SimpleConfig | electrum directory /home/user/.electrum/testnet
  0.59 | I | logging | Electrum version: 4.3.4 - https://electrum.org - https://github.com/spesmilo/electrum
  0.59 | I | logging | Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]. On platform: Linux-5.15.0-58-generic-x86_64-with-glibc2.35
  0.59 | I | logging | Logging to file: /home/user/.electrum/testnet/logs/electrum_log_20230202T151759Z_220451.log
  0.59 | I | logging | Log filters: verbosity '*', verbosity_shortcuts ''
  0.59 | I | p/plugin.Plugins | registering hardware bitbox02: ('hardware', 'bitbox02', 'BitBox02')
  0.59 | I | p/plugin.Plugins | registering hardware coldcard: ('hardware', 'coldcard', 'Coldcard Wallet')
  0.59 | I | p/plugin.Plugins | registering hardware digitalbitbox: ('hardware', 'digitalbitbox', 'Digital Bitbox wallet')
  0.60 | I | p/plugin.Plugins | registering hardware jade: ('hardware', 'jade', 'Jade wallet')
  0.60 | I | p/plugin.Plugins | registering hardware keepkey: ('hardware', 'keepkey', 'KeepKey wallet')
  0.60 | I | p/plugin.Plugins | registering hardware ledger: ('hardware', 'ledger', 'Ledger wallet')
  1.74 | I | p/plugin.Plugins | loaded payserver
  1.74 | I | p/plugin.Plugins | registering hardware safe_t: ('hardware', 'safe_t', 'Safe-T mini wallet')
  1.74 | I | p/plugin.Plugins | registering hardware trezor: ('hardware', 'trezor', 'Trezor wallet')
  1.74 | I | p/plugin.Plugins | registering wallet type ('2fa', 'trustedcoin')
  1.74 | D | util.profiler | Plugins.__init__ 1.1522 sec
  1.74 | I | exchange_rate.FxThread | using exchange CoinGecko
  1.75 | D | util.profiler | Daemon.__init__ 0.0033 sec
  1.75 | I | daemon.Daemon | starting taskgroup.
  1.75 | I | daemon.Daemon | launching GUI: qt
  1.75 | I | gui.qt.ElectrumGui | Qt GUI starting up... Qt=5.15.3, PyQt=5.15.6
  1.75 | I | daemon.CommandsServer | now running and listening. socktype=unix, addr=/home/user/.electrum/testnet/daemon_rpc_socket
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
  2.04 | D | util.profiler | ElectrumGui.__init__ 0.2865 sec
  2.04 | I | storage.WalletStorage | wallet path /home/user/.electrum/testnet/wallets/test_segwit_2
  2.13 | I | storage.WalletStorage | wallet path /home/user/.electrum/testnet/wallets/test_segwit_2
  5.24 | E | gui.qt.ElectrumGui |
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/__init__.py", line 354, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "/home/user/wspace/electrum/electrum/gui/qt/__init__.py", line 401, in _start_wizard_to_select_or_create_wallet
    db = WalletDB(storage.read(), manual_upgrades=False)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 72, in __init__
    self.load_data(raw)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 102, in load_data
    if not self.requires_upgrade():
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 153, in requires_upgrade
    return self.get_seed_version() < FINAL_SEED_VERSION
  File "/home/user/wspace/electrum/electrum/json_db.py", line 44, in wrapper
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1035, in get_seed_version
    raise WalletFileException('This version of Electrum is too old to open this wallet.\n'
electrum.util.WalletFileException: This version of Electrum is too old to open this wallet.
(highest supported storage version: 50, version of this file: 51)
  5.35 | I | storage.WalletStorage | wallet path /home/user/.electrum/testnet/wallets/wallet_20
  7.90 | I | storage.WalletStorage | wallet path /home/user/.electrum/testnet/wallets/test_segwit_3
  8.48 | D | util.profiler | WalletDB._load_transactions 0.0517 sec
  8.48 | D | util.profiler | AddressSynchronizer.load_local_history 0.0005 sec
  8.48 | D | util.profiler | AddressSynchronizer.check_history 0.0005 sec
  8.70 | D | util.profiler | AddressList.update 0.0000 sec
  9.00 | D | util.profiler | Deterministic_Wallet.try_detecting_internal_addresses_corruption 0.0223 sec
  9.01 | D | util.profiler | ElectrumWindow.load_wallet 0.0808 sec
  9.01 | I | daemon.Daemon | stop() entered. initiating shutdown
  9.01 | I | gui.qt.ElectrumGui | closing GUI
  9.01 | I | daemon.Daemon | stopping all wallets
  9.04 | I | storage.WalletStorage | saved /home/user/.electrum/testnet/wallets/test_segwit_3
  9.04 | D | util.profiler | WalletDB._write 0.0265 sec
  9.04 | I | daemon.Daemon | stopping network and taskgroup
  9.04 | I | daemon.Daemon | taskgroup stopped.
  9.04 | I | daemon.Daemon | removing lockfile
  9.04 | I | daemon.Daemon | stopped
  9.08 | I | p/plugin.Plugins | stopped
QThread: Destroyed while thread is still running
Aborted (core dumped)
```
2023-02-02 15:25:15 +00:00
ThomasV
d6febb5c12 Display mined tx outputs as ShortIDs instead of full transaction outpoints.
ShortIDs were originally designed for lightning channels, and are now
understood by some block explorers.

This allows to remove one column in the UTXO tab (height is redundant).

In the transaction dialog, the space saving ensures that all inputs fit
into one line (it was not the case previously with p2wsh addresses).
For clarity and consistency, the ShortID is displayed for both inputs
and outputs in the transaction dialog.
2023-01-26 10:48:28 +01:00
ThomasV
599ac065fb Qt: unify calls to get_transaction (follow-up 121d8732f1) 2023-01-25 15:55:26 +01:00
ThomasV
9f33cecede qt coins tab: sotz by height 2023-01-18 20:12:05 +01:00
Platon Pronko
eed48a8508 fix adding coins to coincontrol from address list 2023-01-18 13:38:27 +04:00
ThomasV
8fa549c418 Merge pull request #8135 from spesmilo/scid_alias
Add support for option_scid_alias
2023-01-13 18:44:13 +01:00
ThomasV
b9393b0603 Support scid alias:
- save remote alias for use in invoices
 - derive local alias from wallet xpub
 - send channel_type without the option_scid_alias bit
   (apparently LND does not like it)
2023-01-13 15:47:30 +01:00
SomberNight
2a9909c252 locale amounts: consistently use "." as dec point, and " " as thou sep
Always use "." as decimal point, and " " as thousands separator.

Previously,
- for decimal point, we were using
  - "." in some places (e.g. AmountEdit, most fiat amounts), and
  - `locale.localeconv()['decimal_point']` in others.
- for thousands separator, we were using
  - "," in some places (most fiat amounts), and
  - " " in others (format_satoshis)

I think it is better to be consistent even if whatever we pick differs from the locale.
Using whitespace for thousands separator (vs comma) is probably less confusing for people
whose locale would user "." for ts and "," for dp (as in e.g. German).

The alternative option would be to always use the locale. Even if we decide to do that later,
this refactoring should be useful.

closes https://github.com/spesmilo/electrum/issues/2629
2023-01-10 14:45:35 +00:00
ThomasV
63d801e363 Merge pull request #8136 from myxmaster/update-status-bar
Update status bar when preference "Zeros after decimal point" is changed
2023-01-10 14:30:36 +01:00
myxmaster
e6cdcf7413 update status bar when setting "zeros after decimal point" is changed 2023-01-10 13:51:21 +01:00
myxmaster
7dbf046b03 Space between pie chart and balance fix 2023-01-09 23:46:45 +01:00
myxmaster
4a0e337c6d use placeholder for better translation 2023-01-09 17:28:19 +01:00
ThomasV
a1716df115 follow-up 975cdca474 2023-01-06 13:18:27 +01:00
ThomasV
975cdca474 Qt coin control: allow to add/remove coins one by one.
Not many users know how to select multiple coins at once.
2023-01-06 11:45:14 +01:00
SomberNight
824ce64e66 qt gui: display nice error if QR code data overflows
there is existing handler-code at e.g.
1a7634e615/electrum/gui/qt/transaction_dialog.py (L309)
but we should make sure setData() always raises the exc when needed,
as paintEvent() is too late for nice handling.

closes https://github.com/spesmilo/electrum/issues/4288
closes https://github.com/spesmilo/electrum/issues/4280
2023-01-02 13:38:05 +00:00
SomberNight
253150cb36 qt network dialog: don't poll Tor socks proxy, but scan on interaction
Polling is introduces spam in Tor logs.
Also, Tor Browser 12.0 apparently has a bug where our polling renders
the socks proxy unusuable after some time.
see https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/41549

Instead of trying to detect a Tor socks proxy every 10 seconds, we now
run detection when the Qt network dialog gets opened, and also when
the user switches to the "Proxy" tab in the dialog.

fixes https://github.com/spesmilo/electrum/issues/7317
2023-01-02 11:58:16 +00:00