1
0
Commit Graph

14890 Commits

Author SHA1 Message Date
ghost43
b765959dd5 Merge pull request #7772 from SomberNight/202204_fxrate_floats
exchange_rate: normalise some internal types, saner Decimal conversion
2022-04-25 13:28:49 +00:00
SomberNight
cfa6b91f22 wallet_db: rm dependence on PaymentRequest class in convert_version_25
Change convert_version_25 to delete invoices instead of converting them.
convert_version_25 was released ~2 years ago. Wallet files not opened since will have old bip70 invoices deleted upon upgrading.

In general it is ~unsafe for convert_version_* to depend on other modules of the code.
(using e.g. sha256 is fine as its API will never change,
but using e.g. PaymentRequest is dangerous as its API might change over time)
2022-04-23 20:15:10 +02:00
ThomasV
149cccbc4a fix tests (follow-up 2117118047) 2022-04-23 19:40:21 +02:00
ThomasV
a0a81c31bd Qt: hide receive tabs when payment is received. 2022-04-23 19:25:24 +02:00
ThomasV
2117118047 set_request_status: pass the right key to request_status callback. 2022-04-23 19:24:31 +02:00
ThomasV
8354dd006b fix receiving lightning requests without amount 2022-04-23 12:06:24 +02:00
ThomasV
31dc93eade Qt: remove QR button from receive text widget. Add tooltip instead 2022-04-23 10:43:50 +02:00
ThomasV
b9139a2472 minor fix: update_receive_address_styling 2022-04-23 09:28:41 +02:00
SomberNight
adfe542fae wallet_db upgrade: recalc keys of outgoing on-chain invoices
closes https://github.com/spesmilo/electrum/issues/7777
2022-04-22 19:53:55 +02:00
SomberNight
5f7388a475 lnworker: fix get_onchain_history if running with --offline
```
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 898, in timer_actions
    self.update_wallet()
  File "...\electrum\electrum\gui\qt\main_window.py", line 1040, in update_wallet
    self.update_tabs()
  File "...\electrum\electrum\gui\qt\main_window.py", line 1047, in update_tabs
    self.history_model.refresh('update_tabs')
  File "...\electrum\electrum\util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "...\electrum\electrum\util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File "...\electrum\electrum\gui\qt\history_list.py", line 275, in refresh
    transactions = wallet.get_full_history(
  File "...\electrum\electrum\util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "...\electrum\electrum\util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File "...\electrum\electrum\wallet.py", line 947, in get_full_history
    lnworker_history = self.lnworker.get_onchain_history() if self.lnworker and include_lightning else {}
  File "...\electrum\electrum\lnworker.py", line 911, in get_onchain_history
    tx_height = self.lnwatcher.get_tx_height(swap.funding_txid)
AttributeError: 'NoneType' object has no attribute 'get_tx_height'
```
2022-04-22 19:18:07 +02:00
SomberNight
63c8aeb54c wallet: fix paying invoice with "max" amount
fixes https://github.com/spesmilo/electrum/pull/7774
2022-04-22 16:46:47 +02:00
SomberNight
7be8b4f405 fix opening wallet that has "max" amount invoice saved
E | gui.qt.ElectrumGui |
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\__init__.py", line 361, in start_new_window
    window = self._create_window_for_wallet(wallet)
  File "...\electrum\electrum\gui\qt\__init__.py", line 304, in _create_window_for_wallet
    w = ElectrumWindow(self, wallet)
  File "...\electrum\electrum\gui\qt\main_window.py", line 223, in __init__
    self.send_tab = self.create_send_tab()
  File "...\electrum\electrum\gui\qt\main_window.py", line 1537, in create_send_tab
    self.invoice_list = InvoiceList(self)
  File "...\electrum\electrum\gui\qt\invoice_list.py", line 76, in __init__
    self.update()
  File "...\electrum\electrum\gui\qt\invoice_list.py", line 109, in update
    amount = item.get_amount_sat()
  File "...\electrum\electrum\invoices.py", line 158, in get_amount_sat
    return int(amount_msat / 1000)
TypeError: unsupported operand type(s) for /: 'str' and 'int'
2022-04-22 16:46:06 +02:00
ThomasV
fb6047ec46 lnworker: fix can_pay_invoice for trampoline MPP
Call it from the GUI
2022-04-22 15:13:12 +02:00
ThomasV
d34f513532 Qt: adapt receive_lightning_help text 2022-04-22 12:03:51 +02:00
ThomasV
bb2e410942 Do not reuse addresses of expired requests.
Since expired requests are user-visible, it is very
confusing that they get replaced when the user creates
a new request.
2022-04-21 12:16:39 +02:00
ThomasV
f53b413643 set_frozen_state: trigger refresh of piechart in status bar 2022-04-21 11:54:29 +02:00
ThomasV
7be7ea71db follow-up e992e3a9b2 2022-04-21 11:50:42 +02:00
SomberNight
583089d57b exchange_rate: normalise some internal types, saner Decimal conversion
fix https://github.com/spesmilo/electrum/issues/7770
2022-04-20 19:01:10 +02:00
SomberNight
81d0928abd exchange_rate: add some type hints 2022-04-20 18:43:24 +02:00
ThomasV
e992e3a9b2 Qt: follow-up e362d1aac4 2022-04-20 13:42:06 +02:00
ThomasV
ba018c707f Qt: add bolt11_fallback and bip21_lightning options to preferences 2022-04-20 12:48:22 +02:00
ThomasV
cbb51b31d8 kivy updates 2022-04-20 12:48:22 +02:00
ThomasV
0c64a884c9 Qt: show single balance in statusbar
- details in popup dialop
  - piechart in status bar
2022-04-20 12:48:22 +02:00
ThomasV
60865f3902 Show options if we do not have the liquidity to pay a lightning invoice:
pay onchain, open channel, rebalance.

If we do a swap or open a channel, the payment will be scheduled.
2022-04-20 12:48:22 +02:00
ThomasV
2c6e36e89d Fallback addresses
- add fallback address to BOLT-11 LN invoices
   - Qt: if LN payment fails, propose onchain fallback
2022-04-20 12:48:22 +02:00
ThomasV
f18a042955 Qt: receive_lightning_help text 2022-04-20 12:48:22 +02:00
ThomasV
9ba5a34800 Qt receive tab:
- show payment options in tabs: URI, Address or Lightning
 - use vertical tabs to save space
 - switch between QR and text views
 - open standalone QR window through menu, instead of clicking on QR code
2022-04-20 12:48:22 +02:00
ThomasV
bf4455ef30 follow-up db invoice unification:
- fix command line
 - deprecate add_lightning_request
2022-04-20 12:48:22 +02:00
ThomasV
7102fb732e follow-up prev:
- detect payment of requests both onchain or LN
 - create single type of requests in GUI
2022-04-20 12:48:22 +02:00
ThomasV
e392197ab9 wallet_db upgrade:
- unify lightning and onchain invoices, with optional fields for bip70 and lightning
 - add receive_address fields to submarine swaps
2022-04-20 12:48:22 +02:00
gruve-p
75044f334b appimage: update git 2022-04-14 22:53:46 +02:00
SomberNight
e47e0afa91 commands: add "version_info" cmd
example:
```
$ ./run_electrum -o version_info
{
    "aiohttp.version": "3.8.1",
    "aiorpcx.version": "0.22.1",
    "certifi.version": "2021.10.08",
    "cryptodome.version": null,
    "cryptography.path": "/home/user/.local/lib/python3.8/site-packages/cryptography",
    "cryptography.version": "3.4.6",
    "dnspython.version": "2.2.0",
    "electrum.path": "/home/user/wspace/electrum/electrum",
    "electrum.version": "4.2.1",
    "hidapi.version": "0.11.0.post2",
    "libsecp256k1.path": "/home/user/wspace/electrum/electrum/libsecp256k1.so.0",
    "libusb.path": "libusb-1.0.so",
    "libusb.version": "1.0.23.11397",
    "libzbar.path": "/home/user/wspace/electrum/electrum/libzbar.so.0",
    "pyaes.version": "1.3.0",
    "pyqt.path": "/usr/lib/python3/dist-packages/PyQt5",
    "pyqt.version": "5.14.1",
    "qt.version": "5.12.8"
}
```
2022-04-11 17:40:22 +02:00
SomberNight
419fc6e1c1 gui init: raise GuiImportError instead of sys.exit if dep is missing 2022-04-11 17:40:16 +02:00
SomberNight
8e234f3ccd qt gui: better detection of missing PyQt5 at startup
If I use apt on ubuntu to install python3-pyqt5 and then remove it, it leaves an empty namespace:
```
$ python3
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>> import PyQt5.QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtGui'
>>> PyQt5
<module 'PyQt5' (namespace)>
```
2022-04-11 17:38:45 +02:00
accumulator
70fb4bf538 android: create relative .buildozer symlink at correct folder, regardless of CWD (#7759) 2022-04-11 11:44:56 +00:00
SomberNight
3451140ce7 qt coins list: fix populating labels
follow-up e362d1aac4
2022-04-10 15:17:40 +02:00
ThomasV
5bd2524bfb follow-up #7748 2022-04-09 10:51:09 +02:00
ThomasV
877a9f553b Merge pull request #7748 from spesmilo/confirm_reverse_swaps
Confirm reverse swaps
2022-04-09 10:41:02 +02:00
ThomasV
3e6595ae98 Merge pull request #7756 from SomberNight/202204_qt_taskthread_cancel
qt taskthread cleaner shutdown
2022-04-09 10:38:06 +02:00
ThomasV
f0a806ccf8 Merge pull request #7754 from SomberNight/202204_wallet_uptodate2
wallet: "up_to_date" to wait for SPV/Verifier
2022-04-09 07:40:44 +02:00
SomberNight
29c1106988 qt main_window: move TaskThread from wallet.thread to window.thread 2022-04-08 20:50:03 +02:00
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
SomberNight
214ac19f15 window.run_coroutine_from_thread: don't use wallet.thread
wallet.thread was serialising the fut.result() calls, so consider e.g.
- coro1 gets scheduled,
- wallet.thread waits on fut1.result()
- coro2 gets scheduled,
- coro2 finished with exception and wants to show an error popup,
-> wallet.thread is still waiting on fut1.result() before it looks at fut2.result
2022-04-07 20:20:30 +02:00
SomberNight
96c063028a qt TaskThread: implement cancellation of tasks, for cleaner shutdown
fixes https://github.com/spesmilo/electrum/issues/7750

Each task we schedule on `TaskThread` can provide an optional `cancel` method.
When stopping `TaskThread`, we call this `cancel` method on all tasks in the queue.
If the currently running task does not implement `cancel`, `TaskThread.stop` will block
until that task finishes.

Note that there is a significant change in behaviour here:
`ElectrumWindow.run_coroutine_from_thread` and `ElectrumWindow.pay_lightning_invoice`
previously serialised the execution of their coroutines via wallet.thread.
This is no longer the case: they will now schedule coroutines immediately.
So for example, the GUI now allows trying to pay multiple LN invoices "concurrently".
2022-04-07 19:51:58 +02:00
ThomasV
ad41f4aed0 trampoline legacy mpp: link to eclair issue 2022-04-07 19:50:30 +02:00