1
0
Commit Graph

14793 Commits

Author SHA1 Message Date
ThomasV
5faef83874 rm dead code 2022-07-20 09:56:53 +02:00
ThomasV
30609cdc63 Qt: simplify lightning_tx_dialog using ShowQRLineEdit 2022-07-20 09:51:26 +02:00
Sander van Grieken
bbbb19eee4 qml: dedupe swap auth handling, fix fee values when no tx 2022-07-20 07:53:41 +02:00
Sander van Grieken
2ea1d88567 qml: use closebutton icon for label edit cancel
UI PIN entry dialog
2022-07-20 07:53:25 +02:00
ThomasV
6a74ffe80e Qt: improve channel details dialog. Add util.ShowQRLineEdit class. 2022-07-19 14:57:33 +02:00
ThomasV
4ff1ed5de5 show_lightning_invoice: minor improvements 2022-07-19 10:32:22 +02:00
ThomasV
85d354bf24 Qt show_lightning_invoice: show features 2022-07-19 10:15:55 +02:00
ThomasV
1568c10ca0 fix 'view log' menu (follow-up 2d68350900) 2022-07-18 14:09:50 +02:00
SomberNight
ed65f335bd wallet_db upgrade: fix possible corruption of invoice amounts
see https://github.com/spesmilo/electrum/pull/7774
2022-07-15 18:26:13 +02:00
SomberNight
d5b5f82b01 LN invoice: better handle unknown required featured bits in bolt11 invs
A user provided an invoice that requires feature bit 30. (That bit is not in the spec)
To test:
```
lnbc1p324a66pp5tundykxx3q5kztsr8x00eknpn2uwe3394cnky3j9a0fswm568wnsdp9facx2mj5d9kk2um5v9khqueqv3hkuct5d9hkucqzpgxq9z0rgqsp5l73jgfgctzc92juer5rk2mqcrkj8teng53dr9vfxj4n8lulu4jmq9q8pqqqssq4gacn859tpzz99hkusnh7m93d5ncpx3t4zns8ynca7akmljpl5vh504qjz7dqwewqjh4md7xagaz5wg85knvxywrhp0sp2t09yta7lcq3qs6fy

lntb1p324a66pp5tundykxx3q5kztsr8x00eknpn2uwe3394cnky3j9a0fswm568wnssp5l73jgfgctzc92juer5rk2mqcrkj8teng53dr9vfxj4n8lulu4jmqdp9facx2mj5d9kk2um5v9khqueqv3hkuct5d9hkuxq9z0rgq9q8pqqqssqdte0z9dy7ur7fagsk7r3mtfj6upq88xfylhufys87zqpamklcfgn2f3xeq3nlhvn3qy9tdgg42vq9eq99qz6rz6tzqezfhzuv6zsr5qp7cgel4
```
2022-07-15 18:00:33 +02:00
ThomasV
f5abd4f1d1 add command line for rebalancing channels 2022-07-13 10:14:34 +02:00
SomberNight
1e97491124 qt QRDialog: make dialog usefully resizeable
In commit 9bba65199e,
the QRCodeWidget was put inside a BoxLayout as a workaround to avoid the "copy to clipboard" and
"save as file" functionality grabbing extra whitespace/stretch/padding and putting it into the
exported image.

However, in turn that commit introduced a bug, where making the dialog larger does not make the
QRCodeWidget larger (which worked prior).

This commit tries to fix the regression and also the original bug.
2022-07-12 19:26:01 +02:00
Sander van Grieken
894495aa92 qml: clean up 2022-07-12 19:07:19 +02:00
Sander van Grieken
63fed38305 qml: skip wallet password entry when single_password and password is known 2022-07-12 17:34:52 +02:00
Sander van Grieken
70cf44ccec qml: wip single password 2022-07-12 16:55:11 +02:00
SomberNight
430a61eb42 qt QRDialog: try to fix layout-sizing issues
related https://github.com/spesmilo/electrum/pull/7218
closes https://github.com/spesmilo/electrum/pull/7223
2022-07-12 16:50:49 +02:00
SomberNight
28fe345b0b keystore.check_password: raise better exc if called on pwless ks
If keystore.check_password is called with some pw on a keystore that does not have a password set,
it now raises better exceptions: it should now always raise InvalidPassword, and with a nicer msg.
Previously the exc type would depend on the ks type.

Examples before change:

```
>>> wallet.keystore.check_password("asd")
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/keystore.py", line 580, in check_password
    xprv = pw_decode(self.xprv, password, version=self.pw_hash_version)
  File "/home/user/wspace/electrum/electrum/crypto.py", line 311, in pw_decode
    plaintext_bytes = pw_decode_bytes(data, password, version=version)
  File "/home/user/wspace/electrum/electrum/crypto.py", line 270, in pw_decode_bytes
    data_bytes = bytes(base64.b64decode(data))
  File "/usr/lib/python3.10/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
```

```
>>> wallet.keystore.check_password("asd")
Traceback (most recent call last):
    s = aes_decrypt_with_iv(secret, iv, e)
  File "/home/user/wspace/electrum/electrum/crypto.py", line 157, in aes_decrypt_with_iv
    data = decryptor.update(data) + decryptor.finalize()
  File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 148, in finalize
    data = self._ctx.finalize()
  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 193, in finalize
    raise ValueError(
ValueError: The length of the provided data is not a multiple of the block length.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/console.py", line 254, in exec_command
    result = eval(command, self.namespace, self.namespace)
  File "<string>", line 1, in <module>
  File "/home/user/wspace/electrum/electrum/keystore.py", line 248, in check_password
    self.get_private_key(pubkey, password)
  File "/home/user/wspace/electrum/electrum/keystore.py", line 267, in get_private_key
    sec = pw_decode(self.keypairs[pubkey], password, version=self.pw_hash_version)
  File "/home/user/wspace/electrum/electrum/crypto.py", line 311, in pw_decode
    plaintext_bytes = pw_decode_bytes(data, password, version=version)
  File "/home/user/wspace/electrum/electrum/crypto.py", line 271, in pw_decode_bytes
    return _pw_decode_raw(data_bytes, password, version=version)
  File "/home/user/wspace/electrum/electrum/crypto.py", line 255, in _pw_decode_raw
    raise InvalidPassword() from e
electrum.util.InvalidPassword: Incorrect password
```

-----

Examples after change:
```
>>> wallet.keystore.check_password("asd")
Traceback (most recent call last):
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "...\electrum\keystore.py", line 68, in wrapper
    return check_password_fn(self, password)
  File "...\electrum\keystore.py", line 605, in check_password
    xprv = pw_decode(self.xprv, password, version=self.pw_hash_version)
  File "...\electrum\crypto.py", line 311, in pw_decode
    plaintext_bytes = pw_decode_bytes(data, password, version=version)
  File "...\electrum\crypto.py", line 267, in pw_decode_bytes
    raise CiphertextFormatError("ciphertext not valid base64") from e
electrum.crypto.CiphertextFormatError: ciphertext not valid base64

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "...\electrum\gui\qt\console.py", line 254, in exec_command
    result = eval(command, self.namespace, self.namespace)
  File "<string>", line 1, in <module>
  File "...\electrum\keystore.py", line 76, in wrapper
    raise InvalidPassword("password given but keystore has no password") from e
electrum.util.InvalidPassword: password given but keystore has no password
```

```
>>> wallet.keystore.check_password("asd")
Traceback (most recent call last):
    s = aes_decrypt_with_iv(secret, iv, e)
  File "...\electrum\crypto.py", line 158, in aes_decrypt_with_iv
    data = cipher.decrypt(data)
  File "...\Python310\site-packages\Cryptodome\Cipher\_mode_cbc.py", line 246, in decrypt
    raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "...\electrum\keystore.py", line 68, in wrapper
    return check_password_fn(self, password)
  File "...\electrum\keystore.py", line 272, in check_password
    self.get_private_key(pubkey, password)
  File "...\electrum\keystore.py", line 291, in get_private_key
    sec = pw_decode(self.keypairs[pubkey], password, version=self.pw_hash_version)
  File "...\electrum\crypto.py", line 311, in pw_decode
    plaintext_bytes = pw_decode_bytes(data, password, version=version)
  File "...\electrum\crypto.py", line 268, in pw_decode_bytes
    return _pw_decode_raw(data_bytes, password, version=version)
  File "...\electrum\crypto.py", line 249, in _pw_decode_raw
    raise InvalidPassword() from e
electrum.util.InvalidPassword: Incorrect password

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "...\electrum\gui\qt\console.py", line 254, in exec_command
    result = eval(command, self.namespace, self.namespace)
  File "<string>", line 1, in <module>
  File "...\electrum\keystore.py", line 76, in wrapper
    raise InvalidPassword("password given but keystore has no password") from e
electrum.util.InvalidPassword: password given but keystore has no password
```
2022-07-12 15:50:45 +02:00
SomberNight
79fec3417a crypto.py: rm {En,De}codeAES_base64. instead use {En,De}codeAES_bytes 2022-07-12 15:50:42 +02:00
SomberNight
d067e0e314 wallet: make "invoices" and "receive_requests" private
Other modules should use getters such as "get_request(key)" or "get_unpaid_requests()",
direct access is error-prone.
2022-07-12 15:46:47 +02:00
SomberNight
056de017f0 wallet: use get_request(addr) instead of receive_requests[addr]
since "invoice unification", requests are often keyed by rhash
2022-07-12 15:38:54 +02:00
SomberNight
44655bcca2 qt qrtextedit: also show icon in ShowQRTextEdit.contextMenu
follow-up 955986d024
2022-07-12 15:33:28 +02:00
ThomasV
436360db10 revert 02e4569086 2022-07-12 14:17:22 +02:00
ThomasV
46cfe781e3 initial release notes for 4.3 2022-07-12 14:16:49 +02:00
Sander van Grieken
d0a9420c87 qml: fix initial focus wallet name in new wallet wizard 2022-07-12 14:01:04 +02:00
Sander van Grieken
f83c944f0e qml: properly set keystore password when creating new wallet 2022-07-12 14:00:53 +02:00
ThomasV
02e4569086 auto-remove redeemed channel backups. fix indentation. 2022-07-12 10:13:19 +02:00
SomberNight
955986d024 qt: PayToEdit and OverlayControlMixin: move around input buttons 2022-07-11 19:08:53 +02:00
SomberNight
2c73e7f854 wallet: (regression) fix get_spendable_coins when "domain" arg is given
`get_spendable_coins` was ignoring the "domain" param, and returning utxos for the whole wallet
2022-07-11 16:18:38 +02:00
ThomasV
9ae0e5bffc remove lightning parameter from wallet.create_request 2022-07-11 13:52:13 +02:00
ThomasV
957174a039 all GUIs: show local and remote force-close options in a homogeneous way 2022-07-11 13:08:04 +02:00
ThomasV
8c991ef656 channels_list: refactor menu. Add request_force_close option for channels too, guard it with a confirmation dialog. 2022-07-11 12:16:17 +02:00
ThomasV
88b2dc3589 show onchain address of request in CLI. Fixes #7886 2022-07-11 11:35:21 +02:00
ThomasV
9b075ba187 get_node_alias: allow node_id prefixes for channel backups 2022-07-11 11:30:02 +02:00
ThomasV
36a6fd6311 request_force_close_from_backup:
- for an onchain backups, if the channel is with a
   hardcoded trampoline, try first without gossip DB.
 - for imported backups, fallback to gossip DB if we
   fail to connect with the provided network address.
2022-07-11 11:16:43 +02:00
SomberNight
9b8750b9cc wallet.export_invoice: should support onchain invoice with "!" (max) amount
As the GUI allows saving such invoices, CLI should not break for these wallets.
Also note the pre-existing assert on the next line.

follow-up bf4455ef30

```
>>> list_invoices()
Traceback (most recent call last):
  File "...\electrum\gui\qt\main_window.py", line 1506, in <lambda>
    return lambda *args, **kwargs: f(method,
  File "...\electrum\commands.py", line 191, in _run
    result = fut.result()
  File "...\Python310\lib\concurrent\futures\_base.py", line 446, in result
    return self.__get_result()
  File "...\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
    raise self._exception
  File "...\electrum\commands.py", line 154, in func_wrapper
    return await func(*args, **kwargs)
  File "...\electrum\commands.py", line 1188, in list_invoices
    return [wallet.export_invoice(x) for x in l]
  File "...\electrum\commands.py", line 1188, in <listcomp>
    return [wallet.export_invoice(x) for x in l]
  File "...\electrum\wallet.py", line 2405, in export_invoice
    amount_sat = int(x.get_amount_sat())
ValueError: invalid literal for int() with base 10: '!'
```
2022-07-10 16:26:20 +02:00
SomberNight
68581ce80a invoices: fix type hint for get_address() 2022-07-10 16:08:02 +02:00
ghost43
45a6290987 Merge pull request #7885 from gruve-p/patch-2
Update windows and appimage
2022-07-09 14:30:02 +00:00
gruve-p
e50db4bf2b appimage: update libssl-dev libssl1.1 openssl
Windows image: update gnupg2 dirmngr
2022-07-09 14:41:41 +02:00
ThomasV
fbd7d504a8 Merge pull request #7884 from SomberNight/202207_wallet_rm_get_onchain_request_status
wallet: rm get_onchain_request_status; just use is_onchain_invoice_paid
2022-07-09 10:42:12 +02:00
SomberNight
57b17d13ac android build: make building testnet apk easier
Just uncomment line 53 in make_apk, and you get a testnet apk that can co-exist with your mainnet install.
No need to do a clean rebuild of ".buildozer/" either.
2022-07-09 04:47:37 +02:00
SomberNight
e72f575eea android build: factor out package name ("org.electrum.electrum")
to make it easier to change, to make it easy to have a co-existing mainnet and testnet install
(or two mainnet installs, etc)
2022-07-09 04:47:32 +02:00
SomberNight
bcbe69672e qml gui: fix flake8 "F821 undefined name" errors 2022-07-09 03:49:45 +02:00
SomberNight
9c5277c9a1 wallet: rm get_onchain_request_status; just use is_onchain_invoice_paid
There is some duplication between `wallet.get_onchain_request_status` and `wallet.is_onchain_invoice_paid`
(both in terms of code, and conceptually). `get_onchain_request_status` is used for incoming invoices (receive requests),
and `is_onchain_invoice_paid` is used for outgoing invoices. I think `get_onchain_request_status` existed first,
but as it uses txi/txo, it only works for ismine addresses, so `is_onchain_invoice_paid` was added later
(along with a `get_prevouts_by_scripthash` and corresponding new persisted data structure) to handle the non-ismine
addresses corresponding to outgoing invoices.

I think we could just merge the two functions together... (?)
and this PR does that.
2022-07-09 03:32:33 +02:00
SomberNight
60a0fcb6e5 Merge branch 'android-qml' 2022-07-08 19:45:11 +02:00
SomberNight
d79da7a248 android build: (qml) pin new transitive dependencies for reproducibility 2022-07-08 16:37:05 +02:00
SomberNight
bc88e1c328 android build: (qml) bump p4a commit
to include single new commit c6e39ae1fb
2022-07-08 16:37:01 +02:00
Sander van Grieken
2c92174ee0 qewallet: fix useNotify signal emit 2022-07-08 16:27:18 +02:00
Sander van Grieken
2c656a0cf7 add excepthooks, hoping to force a backtrace log when qt5 SIGABRTs 2022-07-08 16:25:44 +02:00
SomberNight
3d0baf8d00 android build: restore prev "make theming" behaviour
- note: "make theming" is kivy-specific, and not needed for the qml gui apk
- note: "make theming" does not run automatically as part of the build scripts,
        although it used to in the past. For reproducible builds, the
        "electrum/gui/kivy/theming/atlas" git submodule contains the build
        artefacts. However, the user is supposed to manually run "make theming"
        when changing the atlas/images.
2022-07-08 13:35:28 +02:00
SomberNight
75e7f5e2f8 run_electrum: fix DeprecationWarning re importlib.find_loader 2022-07-08 13:32:41 +02:00