Commit Graph

4817 Commits

Author SHA1 Message Date
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: https://github.com/spesmilo/electrum/commit/121d8732f1e1d97f70a0f72221b4acca1e818319
2022-06-10 18:55:55 +02: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
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
SomberNight b6de15b95d util.profiler: make log line easier to understand 2022-06-09 19:46:42 +02:00
SomberNight 2841cbeade addr_sync: also trigger address_history_changed when a tx is removed 2022-06-09 19:24:55 +02:00
SomberNight 8674fd96d5 lnworker: also check expiring_htlcs in ChannelState.SHUTDOWN
otherwise the remote could intentionally send "shutdown" during an attack
2022-06-07 22:37:25 +02:00
SomberNight f7573dbce6 qt main_window: (trivial) rm dead code, and fix copy-paste error 2022-06-07 19:57:53 +02:00
SomberNight 90dbac5a65 lnpeer: make "trigger_force_close" work with eclair 0.7+ remotes 2022-06-07 19:53:27 +02:00
ThomasV 0ed4fea899 Revert "num_sats_can_receive: bucket channels that we have with the same node"
This reverts commit c06a9ccb9c.
2022-06-05 09:10:32 +02:00
ThomasV c06a9ccb9c num_sats_can_receive: bucket channels that we have with the same node 2022-06-04 11:17:21 +02:00
SomberNight 450476dcb6 qt seed_dialog: warn when trying to restore standard seed as 2FA wallet
closes https://github.com/spesmilo/electrum/issues/7837
2022-06-03 19:05:48 +02:00
SomberNight 780408285c qt "Wallet Info" dialog: show bip32 root fingerprint
and also show it in DeviceMgr.select_device

follow-up https://github.com/spesmilo/electrum/commit/998cd0d356fcd9ed1bd835c3a1abe81737a8b73b
2022-06-03 18:02:58 +02:00
SomberNight 574243b897 hww ledger: call scan_devices fewer times 2022-06-03 17:14:51 +02:00
SomberNight 998cd0d356 hww: make DeviceMgr.select_device dlg msg more explicit (add details)
related https://github.com/spesmilo/electrum/issues/4199#issuecomment-1145063552
2022-06-03 17:14:47 +02:00
SomberNight b5d3f1458a hww: impl get_client in Hardware_KeyStore instead of subclasses 2022-06-03 17:14:44 +02:00
SomberNight 745e697188 hww: move trigger_pairings to DeviceMgr 2022-06-03 17:14:40 +02:00
ThomasV a0e791a6e5 If util.trigger_callback() is called from the asyncio loop,
run the callback synchronously.
2022-06-03 16:38:47 +02:00
SomberNight a758c99bbe kivy: add "clear all gossip" button in ln gossip dialog
One usecase is perhaps to save space if using trampoline anyway...
more importantly, if using gossip, LNGossip is heavily filtering what messages we request and get,
and e.g. can missing new NodeAnnouncements, etc,
and this is a quick-and-dirty workaround to force a fresh start.
2022-06-02 18:28:21 +02:00
SomberNight fbc750bab1 qt.util: HelpLabel, HelpButton, InfoButton: factor out HelpMixin
based on https://github.com/Electron-Cash/Electron-Cash/commit/3ca8854007556363c6ef201aac5fe275294abf7e

Co-authored-by: Calin Culianu <calin.culianu@gmail.com>
2022-06-02 15:25:07 +02:00
Jonas Lundqvist b7b53e56bc Qt PayToEdit: add option to scan QR code from screen(shot)
this ports the following commits:
https://github.com/Electron-Cash/Electron-Cash/commit/448376e4410951f12f53ce42b59bdfe856afc66b
https://github.com/Electron-Cash/Electron-Cash/commit/6053f6f696c3f65a93a84e570454e8a1d8c5f490
2022-06-01 19:10:01 +02:00
SomberNight 9d125118da qrreader.get_qr_reader: raise instead of returning None
move MissingQrDetectionLib to core lib
2022-06-01 18:54:24 +02:00
Axel Gembe 01d20cba49 qt PayToEdit: various fixes, incl icon size/pos, field size, scrollbar
this ports https://github.com/Electron-Cash/Electron-Cash/pull/1371

including commits:
---
https://github.com/Electron-Cash/Electron-Cash/commit/bab816e2c3ace1624f6e981e947bcf1440728852

Buttons Editor: Make background non-transparent and change to push button

There were some issues with transparent backgrounds with QToolButton on
Linux and as there is no real reason for them to be transparent we just
make them opaque.
---
https://github.com/Electron-Cash/Electron-Cash/commit/2cb698affc3ddf1049f1fdd5d55a842b9b7c192b
Pay to editor: Fix size computations to use the proper values

Previously this did not take into account the spacing between lines nor
the margins of the control and the document. There is also a sensible
minimum height of one line now and it expands to up to 10 lines before
we show the scroll bar. When the scroll bar is active, we move the buttons
so they do not obscure the scroll bar.
---
https://github.com/Electron-Cash/Electron-Cash/commit/1b7a70f4f5b9362ca83d4d35627135bbd0d19aec
Pay to editor: Increase height by one if cursor is under buttons
---
https://github.com/Electron-Cash/Electron-Cash/commit/abd42d9f664960210d0c2df29c6ff9dfd6d44015
 Buttons Editor: Always center if the document is just one line high
---
https://github.com/Electron-Cash/Electron-Cash/commit/33bd0b82e0fac5bfd2447b06668889fa249213c9
Pay to editor: Make button movement on scrollbar change reliable
---
https://github.com/Electron-Cash/Electron-Cash/commit/94f8476c2e89584275280de280a93a18ad0194a3
Pay to editor: Use document lineCount instead of height
---
https://github.com/Electron-Cash/Electron-Cash/commit/5bedfce392a0aac0345a1c070c72d75d9449ea18
Buttons Editor: Improve vertical centering of the buttons, needs to take into account the frame width
---
https://github.com/Electron-Cash/Electron-Cash/commit/0cd0b490c45620a5700b0c1ccfad5d3593dbe6ff
Buttons Editor: Add transparent border which is somehow needed for correct macOS layout
2022-06-01 18:24:37 +02:00
Axel Gembe 2d1727520f qt ButtonsWidget: refactor into OverlayControlMixin; fix alignmt/hover
This ports the following:
https://github.com/Electron-Cash/Electron-Cash/commit/782f213bbd945bb4e74dc73116afdaac5ddc9d84
https://github.com/Electron-Cash/Electron-Cash/commit/2e5af27a7ce65c3da6632b4787c70ff8359a8d2c
https://github.com/Electron-Cash/Electron-Cash/commit/889fcbd26aa85dd0c0b8a9537071c816e996835e
https://github.com/Electron-Cash/Electron-Cash/commit/c07b0ad616f136dc6c9f52d825d5a2add59a5175
2022-06-01 17:27:32 +02:00
Axel Gembe 798dbca880 qt ButtonsWidget: Don't pass app instance to addCopyButton
Doesn't make sense to pass the application when we can just use
QApplication.instance() instead.

from https://github.com/Electron-Cash/Electron-Cash/commit/54ccf640c5f9f1eb3e38a644f8da3bd7ed1f93dd
2022-06-01 17:01:21 +02:00
SomberNight abe3955d91 qt.util.ButtonsWidget: add custom setText arg to methods
I am planning to use this in qt.PayToEdit.
2022-05-31 16:40:22 +02:00