1
0
Commit Graph

14246 Commits

Author SHA1 Message Date
SomberNight
428dff90f8 address_sync: include verifier in sync_state progress indicator 2022-04-08 20:36:45 +02:00
SomberNight
30650c524c address_sync: "up_to_date" now waits for SPV 2022-04-08 20:35:23 +02:00
SomberNight
a05ef140d6 address_sync: split off unconfirmed_tx from unverified_tx 2022-04-08 20:34:45 +02:00
SomberNight
837fc1606c address_sync: change up_to_date to be private; no lock needed to read
After some consideration I am fairly certain there is no need to take
wallet.lock in `is_up_to_date()`. Any caller that might want some kind
of guarantees re the value returned by is_up_to_date() would need to
enforce them itself by e.g. taking wallet.lock around its critical code
block. That is, even if is_up_to_date() itself takes the lock, between
the call returning and the caller reading the value there could still
have been a race.
Also, the GUI was directly accessing the field already.
2022-04-08 20:33:13 +02:00
SomberNight
6c05de6fb9 osx arm notes: simplify
note: `pip install ".[crypto]"` needs quotes on macOS, at least in the default `zsh` shell.
The quotes are not needed on Ubuntu using bash, or on Windows using powershell.
```
user@users-iMac electrum % python3 -m pip install --user -e .[crypto]
zsh: no matches found: .[crypto]
```
2022-04-08 20:22:50 +02:00
Bitkarrot
36a685d560 Notes for Apple M1 build from source (#7747)
* Create notes_for_arm.md
2022-04-08 18:12:12 +00:00
ThomasV
ad41f4aed0 trampoline legacy mpp: link to eclair issue 2022-04-07 19:50:30 +02:00
SomberNight
ea21ae35e8 mac build: add workaround for installing pyinstaller with setuptools 61
- the mac build broke with 184e122c36
- upstream fix is at https://github.com/pyinstaller/pyinstaller/pull/6701
  however, we are using an old version of pyinstaller atm, so this workaround is easier

log excerpt of failed build:
```
💬 INFO:  Installing PyInstaller.
Processing ./contrib/osx/.cache/pyinstaller
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      Traceback (most recent call last):
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/build_meta.py", line 188, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/build_meta.py", line 281, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 75, in <module>
          setup(
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 122, in setup
          dist.parse_config_files()
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/dist.py", line 850, in parse_config_files
          setupcfg.parse_configuration(
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/setupcfg.py", line 167, in parse_configuration
          meta.parse()
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/setupcfg.py", line 446, in parse
          section_parser_method(section_options)
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/setupcfg.py", line 417, in parse_section
          self[name] = value
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/setupcfg.py", line 238, in __setitem__
          value = parser(value)
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/setupcfg.py", line 552, in _parse_version
          return expand.version(self._parse_attr(value, self.package_dir, self.root_dir))
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/setupcfg.py", line 372, in _parse_attr
          return expand.read_attr(attr_desc, package_dir, root_dir)
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/expand.py", line 194, in read_attr
          module = _load_spec(spec, module_name)
        File "/Users/user/wspace/electrum/contrib/osx/build-venv/lib/python3.9/site-packages/setuptools/config/expand.py", line 214, in _load_spec
          spec.loader.exec_module(module)  # type: ignore
        File "<frozen importlib._bootstrap_external>", line 850, in exec_module
        File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
        File "/Users/user/wspace/electrum/contrib/osx/.cache/pyinstaller/PyInstaller.py", line 16, in <module>
          from PyInstaller.__main__ import run
      ModuleNotFoundError: No module named 'PyInstaller.__main__'; 'PyInstaller' is not a package
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
```
2022-04-06 21:01:15 +02:00
SomberNight
3bae7dfd90 mac build: git clone pyinstaller to allow using custom commits
This allows more freedom than using releases from PyPI.
(atm there is no released version that fixes https://github.com/pyinstaller/pyinstaller/pull/6701 )
Also, we now build the pyinstaller bootloader, just like in the windows build:
one fewer binary blob to trust.
2022-04-06 21:01:11 +02:00
SomberNight
4d2d2a7bc3 win build: update wine
- the windows build broke with 184e122c36
- upstream fix being pulled in is https://github.com/pyinstaller/pyinstaller/pull/6701

log excerpt of failed build:
```
💬 INFO:  Installing PyInstaller.
Processing c:\electrum\contrib\build-wine\.cache\win32\pyinstaller
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      Traceback (most recent call last):
        File "C:\python3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <
module>
          main()
        File "C:\python3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in m
ain
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\python3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 164, in p
repare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\python3\lib\site-packages\setuptools\build_meta.py", line 188, in prepare_metadata_for_
build_wheel
          self.run_setup()
        File "C:\python3\lib\site-packages\setuptools\build_meta.py", line 281, in run_setup
          super(_BuildMetaLegacyBackend,
        File "C:\python3\lib\site-packages\setuptools\build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 249, in <module>
          setup(
        File "C:\python3\lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "C:\python3\lib\site-packages\setuptools\_distutils\core.py", line 122, in setup
          dist.parse_config_files()
        File "C:\python3\lib\site-packages\setuptools\dist.py", line 850, in parse_config_files
          setupcfg.parse_configuration(
        File "C:\python3\lib\site-packages\setuptools\config\setupcfg.py", line 167, in parse_configurat
ion
          meta.parse()
        File "C:\python3\lib\site-packages\setuptools\config\setupcfg.py", line 446, in parse
          section_parser_method(section_options)
        File "C:\python3\lib\site-packages\setuptools\config\setupcfg.py", line 417, in parse_section
          self[name] = value
        File "C:\python3\lib\site-packages\setuptools\config\setupcfg.py", line 238, in __setitem__
          value = parser(value)
        File "C:\python3\lib\site-packages\setuptools\config\setupcfg.py", line 552, in _parse_version
          return expand.version(self._parse_attr(value, self.package_dir, self.root_dir))
        File "C:\python3\lib\site-packages\setuptools\config\setupcfg.py", line 372, in _parse_attr
          return expand.read_attr(attr_desc, package_dir, root_dir)
        File "C:\python3\lib\site-packages\setuptools\config\expand.py", line 194, in read_attr
          module = _load_spec(spec, module_name)
        File "C:\python3\lib\site-packages\setuptools\config\expand.py", line 214, in _load_spec
          spec.loader.exec_module(module)  # type: ignore
        File "<frozen importlib._bootstrap_external>", line 850, in exec_module
        File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
        File "C:\electrum\contrib\build-wine\.cache\win32\pyinstaller\PyInstaller.py", line 15, in <modu
le>
          from PyInstaller.__main__ import run
      ModuleNotFoundError: No module named 'PyInstaller.__main__'; 'PyInstaller' is not a package
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
🗯 ERROR: prepare-wine failed
```
2022-04-06 17:32:06 +02:00
SomberNight
250795f137 verifier: small clean-up
this code runs in the interface's group, so it's confusing to call the network's methods
2022-04-04 20:55:47 +02:00
Sander van Grieken
184e122c36 rerun freeze_packages 2022-04-04 00:56:08 +02:00
SomberNight
207600e00c transaction.py: TxOutpoint: nicer __str__ and __repr__
useful e.g. when TxOutpoint is used as key in a dict (and the dict is printed)
2022-04-01 21:31:50 +02:00
SomberNight
0226e7196d swaps: build index(es) for the swaps dict to avoid linear scanning 2022-04-01 21:30:41 +02:00
ThomasV
083205714c Qt: reorganize settings dialog 2022-04-01 20:20:04 +02:00
ThomasV
e362d1aac4 Qt: make display of lists more stable.
Use refresh_row() for address, utxo and contact lists.
Replace unneeded calls to update_tabs() with refresh_tabs()

Fix right-click menu after selecting multiple addresses.
2022-04-01 14:11:31 +02:00
ThomasV
44d3b0bc61 Merge pull request #7724 from spesmilo/rbf_swap
bump fee of swap claim transactions
2022-04-01 13:56:05 +02:00
ThomasV
670f8dbe42 submarine_swaps: use prevout to determine if a txin is claiming a swap 2022-04-01 13:55:36 +02:00
ThomasV
1574e10869 follow-up 92c6d91157: remove paid item from request_list 2022-04-01 11:32:57 +02:00
SomberNight
7268fa55f2 config: abstract away mempool depth format str "%.1f MB from tip"
related: 4dd94172a6
(as that commit introduced depth targets that need more precision to display)
2022-03-31 22:50:31 +02:00
SomberNight
e36d7fed7d swaps: more precise tx size estimation for claim tx when RBF-ing 2022-03-31 20:55:11 +02:00
SomberNight
2b13576eb3 qt history tab: fix double-clicking inside collapsible items
Swaps (both reverse and forward) are displayed in the list as a tree, which can be
expanded/collapsed. When expanded, double-clicking on any of the children (regardless
of child being LN or onchain), was interacting with the incorrect item (the first few
items in the top-level list).

Consider `self.tx_item_from_proxy_row(idx.row())`.
`idx.row()` is probably a small int, e.g. `0`, and `tx_item_from_proxy_row` is just
getting that item from the top-level list.

Note that the right-click>"View ..." context menu behaves correctly, so prior to
this commit it was inconsistent with double-clicking.
2022-03-31 19:10:39 +02:00
SomberNight
357aaff582 swaps: when RBF-ing a forward swap tx, payment amt must not decrease 2022-03-30 19:01:57 +02:00
SomberNight
aa5172faa2 swaps: fix forward swap: lnworker.create_invoice is not async
follow-up cb39bbbd94
2022-03-30 17:42:12 +02:00
ThomasV
1364e7538a bump fee of swap claim transactions
Note: This adds a new field, spent_txid, to PartialTxOutput
2022-03-30 13:44:10 +02:00
SomberNight
4dd94172a6 config: fee slider: add more steps in mempool mode
closes https://github.com/spesmilo/electrum/issues/6474
2022-03-29 20:22:09 +02:00
SomberNight
68ba223ce1 qt ConfirmTxDialog: word-wrap error message text
e.g. this text:
"This transaction requires a higher fee, or it will not be propagated by your current server. Try to raise your transaction fee, or use a server with a lower relay fee."
is too long for a single line.
2022-03-29 20:15:52 +02:00
SomberNight
1810835fae lnchannel: get_capacity() should not raise when running with --offline
```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\channels_list.py", line 295, in do_update_rows
    field_map = self.format_fields(chan)
  File "...\electrum\electrum\gui\qt\channels_list.py", line 99, in format_fields
    capacity_str = self.parent.format_amount(chan.get_capacity(), whitespaces=True)
  File "...\electrum\electrum\lnchannel.py", line 481, in get_capacity
    return self.lnworker.lnwatcher.get_tx_delta(self.funding_outpoint.txid, self.cb.funding_address)
AttributeError: 'NoneType' object has no attribute 'get_tx_delta'
```
2022-03-29 18:30:55 +02:00
ThomasV
cb39bbbd94 lnworker: make calc_routing_hints_for_invoice and create_invoice non-async 2022-03-29 17:42:04 +02:00
SomberNight
634611272a build appimage: make binary somewhat smaller by excluding stuff
4.1.5->4.2.1, the appimage grew 54M->66M. This change shrinks it back to 58M.
```
$ ls -lah
total 224M
drwxrwxr-x  5 user user 4.0K Mar 27 18:18 .
drwxrwxr-x 16 user user 4.0K Mar 23 16:02 ..
-rwxrw-r--  1 user user  48M Dec 18  2020 electrum-4.0.9-x86_64.AppImage
-rwxrw-r--  1 user user  54M Jan 19 14:25 electrum-4.1.5-x86_64.AppImage
-rwxr-xr-x  1 user user  58M Mar 27 18:12 electrum-4.2.1-dirty-x86_64.AppImage
-rwxrw-r--  1 user user  66M Mar 27 15:00 electrum-4.2.1-x86_64.AppImage
```
I've used the great `ncdu` tool to investigate file sizes.
```
$ du squashfs-root-415/usr/lib/python3.7/ --max-depth=1 | sort -nr | head -n8
154608	squashfs-root-415/usr/lib/python3.7/
138864	squashfs-root-415/usr/lib/python3.7/site-packages
4720	squashfs-root-415/usr/lib/python3.7/lib-dynload
1744	squashfs-root-415/usr/lib/python3.7/encodings
664	squashfs-root-415/usr/lib/python3.7/pydoc_data
460	squashfs-root-415/usr/lib/python3.7/distutils
460	squashfs-root-415/usr/lib/python3.7/asyncio
436	squashfs-root-415/usr/lib/python3.7/email

$ du squashfs-root-421/usr/lib/python3.9/ --max-depth=1 | sort -nr | head -n8
194088	squashfs-root-421/usr/lib/python3.9/
143512	squashfs-root-421/usr/lib/python3.9/site-packages
33824	squashfs-root-421/usr/lib/python3.9/config-3.9-x86_64-linux-gnu
5244	squashfs-root-421/usr/lib/python3.9/lib-dynload
1720	squashfs-root-421/usr/lib/python3.9/encodings
696	squashfs-root-421/usr/lib/python3.9/pydoc_data
520	squashfs-root-421/usr/lib/python3.9/asyncio
464	squashfs-root-421/usr/lib/python3.9/distutils
```
We should delete `usr/lib/python3.9/config-3.9-x86_64-linux-gnu/` (which is 33M unpacked)
With py3.7 (electrum 4.1.5), this folder was named `config-3.7m-x86_64-linux-gnu`,
presumably because the default config to compile py3.7 was `--with-pymalloc`,
but maybe it is not for py3.9... ? not sure. (see https://peps.python.org/pep-3149/ )
2022-03-27 19:27:55 +02:00
ThomasV
90e5984b64 update date in release notes 4.2.1 2022-03-26 19:41:49 +01:00
SomberNight
ec98ef5aee hw ledger: sign_transaction: add progress indicator
related: https://github.com/spesmilo/electrum/issues/7516
2022-03-26 15:26:13 +01:00
SomberNight
c51655ad61 update locale 2022-03-26 03:38:13 +01:00
ghost43
8a6d14ac4f Merge pull request #7741 from SomberNight/202203_build_pip_install_noisolation
build: (reproducibility) always uses `pip install` with `--no-build-isolation`
2022-03-26 02:22:08 +00:00
SomberNight
c93582f661 android build: update README to newer build.sh syntax 2022-03-26 03:21:03 +01:00
SomberNight
98d32f41d5 build: (reproducibility) always uses "pip install" with "--no-build-isolation"
fixes https://github.com/spesmilo/electrum/issues/7737
fixes https://github.com/spesmilo/electrum/issues/7736
related 8559d1eb72
2022-03-26 02:45:47 +01:00
SomberNight
859bd15356 win build: fix reproducibility by excluding *.dist-info/
closes https://github.com/spesmilo/electrum/issues/7739 (but this is just a workaround...)

the proper fix should be done upstream:
https://github.com/pypa/distlib/issues/164
https://bugs.python.org/issue47123
2022-03-25 22:05:51 +01:00
SomberNight
2a2ce612ec win build: add instructions to investigate reproducibility failure 2022-03-25 21:26:10 +01:00
SomberNight
8260a1abb7 win build: set --no-build-isolation when pip installing pyinstaller
fixes https://github.com/spesmilo/electrum/issues/7736
2022-03-25 17:08:55 +01:00
SomberNight
69c5375cc5 prepare release 4.2.1 2022-03-24 15:59:14 +01:00
ThomasV
a15dac2b8c channel_establishment_flow: do not save wallet file backup in the background.
Instead, display a popup everytime, if the channel is not recoverable.
2022-03-24 14:55:45 +01:00
SomberNight
6a34d93ce2 "--portable": more consistent behaviour
The old and new behaviour is as follows:
1. "pyinstaller" case: portable `.exe`, other `.exe`s with `--portable`, and `.dmg` with `--portable`
    - uses `$PWD`
    - note that when you double-click the portable `.exe` on Windows, `$PWD` is set to the parent folder, i.e. the datadir gets put next to the `.exe`
2. appimage `--portable`
    - was broken (see https://github.com/spesmilo/electrum/issues/5551)
    - (CHANGED NOW to) uses `$PWD`
3. git clone
    - next to `run_electrum`
4. unpacking `tar.gz` and running locally from it
    - next to `run_electrum`
5. `pip install *.tar.gz`, and calling "electrum --portable" from terminal
    - used python's user script directory
        - `~/.local/bin/electrum_data`
        - `$VIRTUAL_ENV/bin/electrum_data`
    - (CHANGED NOW to) uses `$PWD`

That is, we now almost always put the datadir in `$PWD`,
except for the local source case, where we put it next to `run_electrum`.

The "appimage" case (2) is now fixed.

The only breaking change is re case 5 which previously behaved completely
unintuitively and most likely not in a useful way.

closes https://github.com/spesmilo/electrum/issues/7732
fixes https://github.com/spesmilo/electrum/issues/5551
2022-03-23 20:10:11 +01:00
SomberNight
5b500f08ea "--portable": make behaviour independent of pyinstaller version
pyinstaller 4.3 changed the value of `__file__`.
This change makes our behaviour independent of that pyinstaller change
(we always behave like old versions of pyinstaller).

fixes https://github.com/spesmilo/electrum/issues/7729
regression was introduced by b5951adc29
2022-03-23 20:09:34 +01:00
SomberNight
5f1a13e4ea run_electrum: small clean-up, and hide DeprecationWarnings if not git
- rename `is_bundle` to `is_pyinstaller` (no semantic changes, just to clearer name)
- define `is_appimage`
- add comment to explain `is_local`
  - its value is the same as before (but more explicit definition)
- define `is_git_clone`, and restrict DeprecationWarnings to that case
2022-03-23 20:09:30 +01:00
ThomasV
92c6d91157 Qt: on status changes, refresh item in invoice_list and request_list,
instead of calling update(), which repopulates the model.
2022-03-23 19:52:28 +01:00
ThomasV
d3476b6ba0 fix deadlock: self.lock should be taken before self.transaction_lock
(self.lock is taken in self.get_tx.height)
2022-03-23 19:27:49 +01:00
SomberNight
05649861c8 qt gui: more resilient startup: catch more exceptions, better fallback
fixes https://github.com/spesmilo/electrum/issues/7447

Consider this trace for 4.2.0:
```
Traceback (most recent call last):
  File "electrum/gui/qt/__init__.py", line 332, in start_new_window
  File "electrum/gui/qt/__init__.py", line 363, in _start_wizard_to_select_or_create_wallet
  File "electrum/gui/qt/installwizard.py", line 302, in select_storage
  File "electrum/util.py", line 504, in get_new_wallet_name
PermissionError: [Errno 1] Operation not permitted: '/Users/admin/Documents/Peach/MS'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "electrum/gui/qt/__init__.py", line 426, in main
  File "electrum/gui/qt/__init__.py", line 307, in wrapper
  File "electrum/gui/qt/__init__.py", line 349, in start_new_window
  File "electrum/util.py", line 504, in get_new_wallet_name
PermissionError: [Errno 1] Operation not permitted: '/Users/admin/Documents/Peach/MS'
```

Note that `get_new_wallet_name` (os.listdir) can raise OSError,
and we were calling that on the main entrypoint codepath without exception-handling.
We were also calling it in the fallback codepath without exception-handling.
i.e. the GUI errored out on every startup for affected users, and without CLI usage
it was not possible to recover.
2022-03-23 03:58:33 +01:00
SomberNight
25fee6a6be kivy: locale: set default language to English
This reverts 7cb11ceda4 (set default language to OS lang).
Some languages (e.g. CJK, Arabic) do not work at all with kivy due to font issues,
so we should never use those as default. It is easiest to just default to English for now.

related https://github.com/spesmilo/electrum/issues/2032
related https://github.com/spesmilo/electrum/issues/4618
related https://github.com/spesmilo/electrum/issues/7494
2022-03-22 17:20:33 +01:00
SomberNight
b91947e585 kivy: delete some dead code 2022-03-22 16:28:04 +01:00
ghost43
483fed42d8 Merge pull request #7727 from SomberNight/202203_qtcamera_preferences_crash
qt gui: (maybe fix) opening "Preferences" segfaults on macOS for some
2022-03-22 14:40:49 +00:00