1
0
Commit Graph

14509 Commits

Author SHA1 Message Date
SomberNight
a2d66ac90c kivy: rm code dupe between app.on_qr and send_screen.do_paste 2022-06-29 16:18:27 +02:00
SomberNight
649cad0122 lnurl: clean-up 2022-06-29 16:18:23 +02:00
SomberNight
82e33984ad lnurl for kivy: I need this to buy beers 2022-06-29 16:18:19 +02:00
bitromortac
fe2fbbd9b1 add lnurl-pay and lightning address support
* bundles all payment identifiers into handle_payment_identifier
* adds lnurl decoding
* adds lightning address decoding
2022-06-29 16:18:15 +02:00
SomberNight
2511d8118c lnworker.get_lightning_history(&get_payment_value): rm failing assert
follow-up e1d34300e5
follow-up dc15d59fcf

```
Traceback (most recent call last):
  File ".../electrum/gui/qt/main_window.py", line 910, in timer_actions
    self.update_wallet()
  File ".../electrum/gui/qt/main_window.py", line 1068, in update_wallet
    self.update_tabs()
  File ".../electrum/gui/qt/main_window.py", line 1075, in update_tabs
    self.history_model.refresh('update_tabs')
  File ".../electrum/util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File ".../electrum/util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File ".../electrum/gui/qt/history_list.py", line 275, in refresh
    transactions = wallet.get_full_history(
  File ".../electrum/util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File ".../electrum/util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File ".../electrum/wallet.py", line 1109, in get_full_history
    lightning_history = self.lnworker.get_lightning_history() if self.lnworker and include_lightning else {}
  File ".../electrum/lnworker.py", line 839, in get_lightning_history
    assert direction == PaymentDirection.FORWARDING
AssertionError
```
2022-06-29 16:12:47 +02:00
ThomasV
dc15d59fcf get_payment_value: rm failing assert 2022-06-29 13:33:04 +02:00
SomberNight
c1d34243a1 lnpeer: (trivial) better log message 2022-06-28 20:34:47 +02:00
SomberNight
4a791f9285 qt.completion_text_edit: fix logic bug re shift/ctrl 2022-06-28 19:51:26 +02:00
SomberNight
3db79210b5 network.run_from_another_thread: add type hint 2022-06-28 18:55:51 +02:00
SomberNight
5b0aad5084 network: rename _send_http_on_proxy and make it part of public API 2022-06-28 18:51:21 +02:00
SomberNight
81880e8538 EventListener: key global dict by modulepath+clsname instead of clsname
follow-up fe74e4b9c9

Just for sanity -- there could be a collision of class names (defined in separate modules).
```
>>> wallet.is_up_to_date.__qualname__
'Abstract_Wallet.is_up_to_date'
>>> wallet.is_up_to_date.__module__
'electrum.wallet'
```
2022-06-27 17:23:08 +02:00
gruve-p
29ab90e1b1 appimage: update libssl-dev libssl1.1 openssl (#7869) 2022-06-24 05:05:09 +00:00
ThomasV
fe74e4b9c9 EventListener: pre-register event listeners in the decorator,
and use that registration in the iterator.

That way, we do not invoke getattr on arbitrary methods, which
could trigger unwanted code execution (for example, if a method
is decorated with @property, getattr will execute its code).
2022-06-23 09:11:16 +02:00
SomberNight
c09903be68 daemon.PayServer.create_request: mark as broken...
looks like it's been broken for a long time.
- self.root ??
- lnworker.add_request API change
2022-06-22 02:46:22 +02:00
SomberNight
cafd5c4af0 lnworker.add_request: force keyword args
and change type-hint to reflect that fallback_address can be None
2022-06-22 02:26:54 +02:00
SomberNight
be322f7ea7 qt dialogs: disconnect signals and unregister callbacks in closeEvent 2022-06-22 02:13:19 +02:00
ghost43
c3093ded21 Merge pull request #7858 from spesmilo/event_listener
EventListener class to handle callbacks
2022-06-22 00:12:34 +00:00
SomberNight
5b000a871f EventListener follow-ups: adapt left-out classes and minor clean-ups 2022-06-22 02:09:26 +02:00
ThomasV
dbf055de9a EventListener class to handle callbacks
and QtEventListener for Qt
2022-06-22 02:07:46 +02:00
SomberNight
fbb3491e97 fix typo: stdio gui with no wallet
same as https://github.com/spesmilo/electrum/pull/3223 - should have been included there
2022-06-22 00:38:41 +02:00
ThomasV
034bd42d9c text guii: display full history 2022-06-17 12:59:35 +02:00
ThomasV
55f46fb61e adb fixes for text and stdio GUIs 2022-06-17 10:04:28 +02:00
ThomasV
e1d34300e5 lnworker: get_payment_value
- the detection of self-payments was using the length
   of the htlc list, incorrectly categorizing all MPPs.
 - the fee for self-payments was not correctly computed.
2022-06-16 21:02:34 +02:00
ThomasV
79428756b2 kivy: in event handlers, check wallet.
We might receive events before the wallet is loaded.
2022-06-16 16:50:31 +02:00
ThomasV
f1289a2a5e fix #7851: store addresses_beyond_gap_limit in address_list 2022-06-16 08:52:30 +02:00
ThomasV
cfb6ab6822 Trampoline: always increase fees, to ensure we do not get stuck in a loop.
Also handle TEMPORARY_CHANNEL_FAILURE, which is sometimes returned by Eclair.
2022-06-15 19:18:04 +02:00
ThomasV
9fe93524b7 Index lightning requests with rhash instead of onchain address.
get_unused_addresses() has been broken since #7730, because
addresses are considered as permanently used if they are in
the list of keys of receive_requests. This is true even if
an address is used as fallback for a lightning payment. This
means that the number of lightning payments we can receive
is constrained by the gap limit.

If a payment succeeds off-chain, we want to be able to reuse
its fallback address in other requests (this does not reduce
privacy, because invoices already share the same public key).

This implies that we should not use the onchain address as key
for lightning-enabled requests in wallet.receive_requests. If
we did, paid invoices would be overwritten when the address is
reused. That is the reason for the wallet_db upgrade.

Related: a3faf85e3c
2022-06-15 18:44:52 +02:00
ThomasV
adb5b6213b follow-up a3faf85e3c 2022-06-14 20:33:19 +02:00
ThomasV
1915330039 Qt receive widgets: do not show request that have expired
They may still be retrieved from the menu
2022-06-14 20:26:54 +02:00
ThomasV
c7418d4dc7 Qt: payment received notification, show label and amount instead of key
The key may be a bitcoin address, even for a lightning payment.
2022-06-14 20:10:24 +02:00
ThomasV
7df24f0adf fix typo 2022-06-14 17:14:02 +02:00
ThomasV
a3faf85e3c wallet:
- add new index: requests_rhash_to_key (fixes #7845)
 - when creating a request, do not save its description in labels.
   Instead, return it as default value in wallet.get_label_by_rhash
lnworker:
  - rename 'payments' to 'payment_info'
  - add note to delete_payment_info
commands: rename 'rmrequest' to 'delete_request'
2022-06-14 13:39:18 +02:00
ThomasV
6bef6fab86 adb: do not notify GUI about already known transactions 2022-06-13 10:53:43 +02:00
ThomasV
c316d406db unconfirmed swaps: revert label change (follow-up 599ad1c017) 2022-06-13 10:37:25 +02:00
ThomasV
53c054ece4 swaps: set spending_txid as soon as tx is added to wallet
This fixes the GUI not displaying the label of the transaction immediately
2022-06-13 10:27:40 +02:00
ThomasV
599ad1c017 lnworker: get_onchain_history does not need to be online anymore 2022-06-13 10:26:07 +02:00
ThomasV
7d5125c935 lnwatcher: fix tx replacement and notifications
- revert the logic of do_breach_remedy to what it was
   before 0ca3d66d15,
   but now calling self.maybe_redeem unconditionally.
 - replace mempool transactions only if the fee increases
 - do not notify the GUI if a local tx is replaced
 - delete labels when replacing
2022-06-12 14:28:11 +02:00
SomberNight
ffe36e2f56 make "-v" (logging to stderr) work with commands
When running a command, file logging is disabled as every
command-invocation would create a new logfile. However if the user
explicitly sets "-v" on the commandline, there's no reason why that
shouldn't work.
2022-06-12 00:54:35 +02:00
SomberNight
29d8d8de26 wallet: (fix) cannot just piggyback on adb.is_up_to_date()
The wallet needs its own up_to_date logic:
- the adb being up_to_date means all its addresses are synced
- but an HD wallet might decide to roll the gap limit and generate new addresses
  - the adb does not know about this...
  - the wallet should be considered *not* up_to_date
- relatedly, it is now the wallet that decides to reset the network request counters

- note that wallet.main() was never cleaned up previously.
  - now wallet gets its own taskgroup, which is cleaned up in wallet.stop.

Follow-up to adb refactor: 121d8732f1
2022-06-10 18:55:55 +02:00
ghost43
0fa28eb3d2 Merge pull request #7847 from SomberNight/202206_lnchan_add_toxic_state
lnchannel: add new states: `WE_ARE_TOXIC`, `REQUESTED_FCLOSE`
2022-06-10 15:19:35 +00:00
SomberNight
1613736b45 lnpeer: rename trigger_force_close to request_force_close
for more consistent naming with rest of the code
2022-06-10 17:13:11 +02:00
SomberNight
f12e87be93 lnchannel: add new states: WE_ARE_TOXIC, REQUESTED_FCLOSE
The `WE_ARE_TOXIC` state is added as a sanity check to ensure that if
the remote has proven that we have lost state we do not accidentally
do a local force-close. E.g. if we receive an "error" message for the
channel, we might normally do an automatic force-close. Manually
force-closing in such a state is not offered anymore by the GUI.

The `REQUESTED_FCLOSE` state is added as it is quite likely that
we receive an error message from the remote after requesting a fclose,
e.g. during a later chan-reestablish. In such a scenario, we should
not do an auto-local-fclose, however the manual option of a local-fclose
should still be offered.
2022-06-10 17:09:33 +02:00
SomberNight
ee85f98fd6 lnchannel: rm "is_closing" method - has confusing semantics
(and there is intentional behaviour changes here, due to erroneous use of "is_closing")
2022-06-10 15:10:52 +02:00
SomberNight
ff1c8b912e follow-up README rename, again
follow-up 0d854555c8
2022-06-10 14:34:20 +02:00
ThomasV
d81610b2e1 wallet: filter non-wallet transactions before rebroadcasting event 2022-06-10 13:07:53 +02:00
ThomasV
6e7ffa29ae Move address_is_old to AddressSynchronizer.
Cache local_height at that level instead of wallet.synchronize
2022-06-10 13:07:53 +02:00
ThomasV
0ca3d66d15 persist_lnwatcher: split try_redeem into two methods:
- maybe_add_redeem_tx
 - maybe_broadcast

Before this commit, local tx that are now persisted
are bot broadcast
2022-06-10 13:07:53 +02:00
ThomasV
c47057b484 Move get_wallet_delta to wallet class, because it requires wallet.is_mine
Do not call it in AddressSynchronizer.get_tx_fee
2022-06-10 13:07:53 +02:00
ThomasV
151500fb72 follow-up afa2ed1fe285886fdd087aa8b1e303e2634d9098 2022-06-10 13:07:53 +02:00
ThomasV
121d8732f1 Persist LNWatcher transactions in wallet file:
- separate AddressSynchronizer from Wallet and LNWatcher
 - the AddressSynchronizer class is referred to as 'adb' (address database)
 - Use callbacks to replace overloaded methods
2022-06-10 13:07:53 +02:00