1
0
Commit Graph

17241 Commits

Author SHA1 Message Date
SomberNight
df58dd1f25 lnchannel.get_close_opts: allow REQUEST_REMOTE_FCLOSE if WE_ARE_TOXIC
related https://github.com/spesmilo/electrum/issues/8770
2024-01-15 20:13:38 +00:00
SomberNight
140d2d0247 lnpeer: fix timing issues in reestablish_channel, for dataloss case
Assume Alice and Bob have a channel, and Alice is on an old state,
but neither of them knows the latter yet.
Timing scenarios:
1. Alice sends reest first, and Bob receives it before sending reest himself
  - old code: Bob realises Alice is behind, Bob will force-close,
              Bob won't send reest to Alice, so Alice does not learn she is behind
  - new code: Bob realises Alice is behind, Bob will force-close,
              Bob will still send reest to Alice, so Alice learns she is behind.
2. Bob sends reest first, and Alice receives it before sending reest herself
  - old code: Alice learns she is behind. Alice won't send reest to Bob,
              so Bob does not learn he is ahead, so Bob won't force-close.
  - new code: Alice learns she is behind. Alice will still send reest to Bob
              though with ctn=0 instead of actual. Bob learns he is ahead, so
              Bob will force close.
3. Alice and Bob both send reest, and then they both receive what the other sent
  - no change: Alice and Bob both learn Alice is behind. Bob will force-close.
2024-01-15 20:13:34 +00:00
SomberNight
95c55c542e lnworker.suggest_splits: (fix) don't force splitting
lnworker.suggest_splits for non-trampoline case tries to split amts over 5000 sat
but mpp_split.suggest_splits does not return splits where any part is smaller than 10000 sat.
So in practice, without trampoline, invoices between 5k and ~20k sats could not be paid.
This suggests that the logic should not be scattered in multiple places but merged into mpp_split.py...
This commit just does a quick fix though, to try again without splitting if there was no solution.
2024-01-15 20:12:16 +00:00
SomberNight
129917c463 lnworker: fix current_feerate_per_kw for regtest
follow-up 45b248fdef

```
121.72 | I | P/lnpeer.Peer.[LNWallet, 034cd7a09f-e1e44142] | FEES HAVE FALLEN
121.72 | I | P/lnpeer.Peer.[LNWallet, 034cd7a09f-e1e44142] | (chan: 502x1x1) current pending feerate 45000. new feerate 250
121.72 | E | W/lnwatcher.LNWalletWatcher.[default_wallet-LNW] | Exception in update_channel_state: Exception('Cannot update_fee: feerate lower than min relay fee. 250 sat/kw. us: True')
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/util.py", line 1148, in wrapper
    return await func(*args, **kwargs)
  File "/home/user/wspace/electrum/electrum/lnwatcher.py", line 434, in update_channel_state
    await self.lnworker.handle_onchain_state(chan)
  File "/home/user/wspace/electrum/electrum/lnworker.py", line 1216, in handle_onchain_state
    peer.maybe_update_fee(chan)
  File "/home/user/wspace/electrum/electrum/lnpeer.py", line 2221, in maybe_update_fee
    chan.update_fee(feerate_per_kw, True)
  File "/home/user/wspace/electrum/electrum/lnchannel.py", line 1490, in update_fee
    raise Exception(f"Cannot update_fee: feerate lower than min relay fee. {feerate} sat/kw. us: {from_us}")
Exception: Cannot update_fee: feerate lower than min relay fee. 250 sat/kw. us: True
```
2024-01-15 19:28:55 +00:00
Sander van Grieken
ec81f00896 trustedcoin: cannot reset OTP when seed is not available (online wallet creation continuation) 2024-01-15 17:45:29 +01:00
Sander van Grieken
57bd291491 call super().__init__() for WalletFileException descendants,
qt: handle unfinished wallets when opened via File>Open (ref #8809)
2024-01-15 17:06:44 +01:00
SomberNight
d660c57808 qt BalanceToolButton: rm hardcoded min size
"18 pixels" is too large when using qdarkstyle on "low" DPI screens, on Windows
(if there is also a high DPI screen connected as another monitor... eh)
2024-01-15 15:08:59 +00:00
SomberNight
66b24411e0 qt BalanceToolButton: better sizing on high DPI screens
specifically, on Windows, with display scaling > 100%, the pie btn was too small (not scaled)
2024-01-15 14:41:00 +00:00
Sander van Grieken
10be631039 qml: tx.txid() can be None in qetxfinalizer. fixes (#8807) 2024-01-13 01:36:45 +01:00
Sander van Grieken
de76eb94d0 android: allow override of FRESH_CLONE target directory
my /tmp is not large enough, this allows override of build location using

export FRESH_CLONE=/some/other/location
2024-01-13 01:19:43 +01:00
Sander van Grieken
a8dc27ef4c android: buildozer ref 4403ecf445f10b5fbf7c74f4621bf2b922ad35b5
buildozer didn't pass android target_sdk_version from spec file
2024-01-13 01:15:52 +01:00
SomberNight
fff6995de4 prepare release 4.5.0 4.5.0 2024-01-11 17:29:42 +00:00
ThomasV
5ea40b4ea4 Merge pull request #8805 from SomberNight/202401_bump_zbar
build: bump zbar
2024-01-11 16:06:12 +01:00
ThomasV
14ec36dba1 Merge pull request #8741 from accumulator/labels_update
add labels_received callback and update labels even when set for item
2024-01-11 16:05:04 +01:00
SomberNight
11764f9a79 android build: make apt less quiet, for more feedback about progress 2024-01-10 20:49:18 +00:00
SomberNight
5369be66da appimage build: build zbar ourselves
to be able to package new version, which has security fixes
2024-01-10 20:48:27 +00:00
SomberNight
0a6283b1ef build: bump zbar version in win/mac/android builds
- new version (0.23.93) fixes a security issue
  bb05ec54ee/ChangeLog (L5)
2024-01-10 20:46:38 +00:00
SomberNight
d89f9846b9 qt/qrreader(zbar): don't call callback if user closes camera window
- without this, in send tab paytoedit, try_payment_identifier will get called and it will error
df1b9a223c/electrum/gui/qt/paytoedit.py (L153)
- also, in all text fields this used to result in clearing the current text (but now it is kept instead)
2024-01-10 20:39:58 +00:00
ThomasV
df1b9a223c remove qt module from swapserver plugin (unused since a300b8968a) 2024-01-10 17:32:31 +01:00
MrNaif2018
7369145a49 Fix graceful shutdown for lightning swaps 2024-01-10 17:17:48 +01:00
ThomasV
178a03129f submarine_swaps: define main_loop, with async with taskgroup
rm unneeded @ignore_exception wrapper in lnworker and network
2024-01-10 17:15:29 +01:00
Sander van Grieken
65210d03ac qml: log txid when assertion fails in qetxdetails.py 2024-01-09 12:57:26 +01:00
ThomasV
d6c45113e4 trustedcoin: do not db.write() from daemon thread. fixes #8791 2024-01-09 12:36:09 +01:00
ghost43
af6467bac4 Merge pull request #8786 from MrNaif2018/fix/in-memory-wallet
Restore ability to pass wallet in-memory
2024-01-08 18:08:01 +00:00
SomberNight
f9d6849b0a tests: add unit tests for prev 2024-01-08 18:03:40 +00:00
SomberNight
f7ea2e0d3c trustedcoin: fix qt wizard two-part-wallet-creation, online phase
```
 25.30 | E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/__init__.py", line 439, in _start_wizard_to_select_or_create_wallet
    wallet = self.daemon.load_wallet(wallet_file, d['password'], upgrade=True)
  File "/home/user/wspace/electrum/electrum/daemon.py", line 481, in func_wrapper
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/daemon.py", line 491, in load_wallet
    wallet = self._load_wallet(path, password, upgrade=upgrade, config=self.config)
  File "/home/user/wspace/electrum/electrum/util.py", line 481, in do_profile
    o = func(*args, **kw_args)
  File "/home/user/wspace/electrum/electrum/daemon.py", line 516, in _load_wallet
    raise WalletUnfinished(db)
electrum.wallet_db.WalletUnfinished: <electrum.wallet_db.WalletDB object at 0x7f11db3a7ca0>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/wizard/wizard.py", line 203, in on_next_button_clicked
    if self.is_finalized(wd):
  File "/home/user/wspace/electrum/electrum/gui/qt/wizard/wallet.py", line 178, in is_finalized
    if not wizard_data['wallet_exists'] or wizard_data['wallet_is_open']:
KeyError: 'wallet_exists'
```
2024-01-05 15:34:20 +00:00
SomberNight
66b8ec1833 trustedcoin: rm some dead code
used by old qt wizard
2024-01-05 15:29:21 +00:00
SomberNight
683c6083c9 wizard: do not log sensitive data (add more keys) 2024-01-05 15:14:33 +00:00
SomberNight
77c55d78b7 qt wizard: show warning when trying to restore 2fa seed as std wallet
With wallet_type=="standard", if the user enters a 2fa electrum seed, the "next" btn is disabled.
This is a regression in the new wizard, the old one used to "redirect" seamlessly.
This commit does not fix this, but at least shows a user-friendly warning message.

Note: would be nice if the wizard redirected automatically, in both directions (2fa->std, std->2fa).
The old wizard implemented std->2fa (probably the more common case hit by users), and had this
warning message shown for the 2fa->std case. Now I am repurposing the warning also for std->2fa.
2024-01-05 15:00:45 +00:00
SomberNight
dab768b932 qt/wizard/wallet: improve typing: introduce WalletWizardComponent cls 2024-01-05 13:34:57 +00:00
SomberNight
37173845c2 qt wizard: WizardComponent: (fix) also inherit ABC
for `@abstractmethod` decorator to work
(except, turns out, it's not so simple because of pyqt's own magic for QWidget)
2024-01-05 13:26:33 +00:00
SomberNight
201c0ab71b qt wizard: fix restoring from 2fa seed
follow-up 7df057aaf9
2024-01-05 12:51:54 +00:00
SomberNight
3b630c7a5b tests: add "short seed cheat sheet"
hopefully I can remember what to ctrl+f to find this
2024-01-05 12:14:33 +00:00
accumulator
35d4cf4d09 Merge pull request #8788 from accumulator/qml_non_historic_fiat
qml: don't show fiat amount when timestamp more than a day old and historic rates are disabled
2024-01-04 17:31:16 +01:00
accumulator
a51b3bdbfb qml: show fiat price when historic rates are enabled and no timestamp available
Co-authored-by: ghost43 <somber.night@protonmail.com>
2024-01-04 17:31:00 +01:00
ghost43
926756c6cc Merge pull request #8789 from accumulator/bip21_req_params_validation
bip21: fail bip21 uri if unsupported req-* parameter is present.
2024-01-04 16:10:55 +00:00
SomberNight
bd88b6ba29 tests: add unit test for prev 2024-01-04 16:00:24 +00:00
Sander van Grieken
313b79cfaf qml: add txid not empty assert to removeLocalTx. ref #8775 2024-01-04 13:08:17 +01:00
Sander van Grieken
0b7fa9cd99 bip21: fail bip21 uri if unsupported req-* parameter is present. fixes #8781 2024-01-04 12:34:17 +01:00
Sander van Grieken
5077e013f3 qml: don't show fiat amount when timestamp more than a day old and historic rates are disabled 2024-01-04 12:25:40 +01:00
MrNaif2018
9b5bead6f4 Restore ability to pass wallet in-memory 2024-01-02 18:46:02 +03:00
accumulator
88058df409 Merge pull request #8772 from accumulator/qml_tx_inputs
qml: add transaction inputs in TxDetails and …
2023-12-29 16:21:22 +01:00
Sander van Grieken
92bff08ba5 qml: don't use predictive text for fields where it makes no sense 2023-12-29 16:18:03 +01:00
Sander van Grieken
3935e378b3 android: p4a ref d976b539dc7c808d103a7edfe6dc1fd300582a89
> don't keep build dir around after succesful build
2023-12-29 16:16:07 +01:00
Sander van Grieken
c1ebc42724 android: p4a ref f534fe9bcd692c4df97e644d34c5bd8acede01eb
> qt6: don't copy entire build tree to dist, use select set of include patterns.
2023-12-29 13:58:46 +01:00
Sander van Grieken
e8852918a7 qml: fix newline in TxDetails 2023-12-29 12:13:49 +01:00
Sander van Grieken
7164392b1c qml: add transaction inputs in TxDetails and ConfirmTxDialog, RbfBumpFeeDialog, RbfCancelDialog, CpfpBumpFeeDialog
and allow collapse/expand of input/output lists by clicking on label.
2023-12-29 11:55:36 +01:00
SomberNight
eee61a98cb gui: cpfp: calc parent fee for cpfp using wallet.get_tx_info
I am only making this change as it makes it simpler to do manual testing of CPFP-ing *local* txs.
That is, by changing a few easy-to-find lines of code, I can make the GUI allow CPFP-ing a local tx, but
without this change it errors out with "unknown fee for parent transaction".

If one has an incoming local tx saved in the wallet, adb.get_tx_fee(txid) returns None
(if the tx gets into the mempool, it will use the server-reported value instead).
In contrast, wallet.get_tx_info(tx).fee calls both wallet.get_wallet_delta(tx) and adb.get_tx_fee(txid),
making it more expensive but more complete.
2023-12-29 02:55:11 +00:00
Sander van Grieken
ceb42c2a1b qml: show frozen lightning balance in BalanceDetails only when non-zero 2023-12-28 12:30:37 +01:00
SomberNight
0dae17339d qml: add config setting to allow screenshots
On Android, we disallow screenshots on screens where the seed is visible.
(The seed is extremely sensitive data that should not be stored digitally without
significant precautions but it's also cumbersome to write down or memorise, so
some people instinctively just try to take a screenshot of it when creating a wallet.)
We do this by using the built-in OS mechanism of setting FLAG_SECURE on the window.
However, on some devices with custom ROMs (one report from LineageOS, one from /e/OS),
unsetting FLAG_SECURE crashes the application for some reason.

As a workaround, this commit adds a config setting into the Preferences,
to disable this mechanism and just always allow screenshots.
(note that you can get into the qml Preferences before creating/opening any wallet)

ref https://github.com/spesmilo/electrum/issues/8522
2023-12-27 07:28:39 +00:00