Commit graph

281 commits

Author SHA1 Message Date
SomberNight
55eb62bb90
wallet.get_relevant_invoice_keys_for_tx: take lock in callee not caller 2020-08-31 21:58:47 +02:00
SomberNight
6b4edc650a
qt history: fixes for tx context-menu "View invoice" if more than one
fixes #6516

coalesce "View invoice" options into submenu if there are multiple;
also make sure lambda uses bound argument
2020-08-31 20:55:14 +02:00
SomberNight
c64da9448f
wallet: get_full_history should populate acq_price/cap_gains if enabled
fixes #6370

qt history tab is calling get_full_history; so this is needed to populate cap_gains columns
2020-08-24 18:17:05 +02:00
SomberNight
4961020e01
wallet: handle exception when deleting last addr from imported wallet
fixes #6347
2020-07-08 01:28:20 +02:00
SomberNight
35dad3c10e
qt history list: only offer "View Invoice" if still have invoice
fixes: #6343
2020-07-08 01:19:23 +02:00
SomberNight
dee5d52948
invoices: make sure that OnchainInvoice .exp and .time are not None
related: #6284
2020-06-27 02:27:50 +02:00
ThomasV
730bfda33a OnchainInvoice: make get_amount_sat return 0 instead of None. fixes #6203 2020-06-26 11:14:23 +02:00
ThomasV
b0c390e231 wallet.clear_requests. fixes #6279 2020-06-26 09:47:16 +02:00
SomberNight
a97cb88a1a
qt sweep: raise more specific exception so that trace is not logged
When raising generic Exception, window.on_error can't tell whether
there was a programming error or we just want to communicate with the user.

E | gui.qt.main_window.[default_wallet] | on_error
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/util.py", line 832, in run
    result = task.task()
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 2900, in <lambda>
    task = lambda: self.network.run_from_another_thread(
  File "/home/user/wspace/electrum/electrum/network.py", line 358, in run_from_another_thread
    return fut.result(timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/home/user/wspace/electrum/electrum/wallet.py", line 162, in sweep_preparations
    raise Exception(_('No inputs found.'))
Exception: No inputs found.
2020-06-25 23:48:24 +02:00
SomberNight
d31883a2ea
wallet.export_{request,invoice}: replace 'amount' field with sat/msat
(was failing as 'amount' was Decimal for LN invoices, which cannot be json-serialised)
2020-06-22 23:38:44 +02:00
SomberNight
d5f368c584
LN invoices: support msat precision
fixes #6250
2020-06-22 22:48:13 +02:00
ThomasV
4bda882695 Group swap transactions in Qt history (fixes #6237)
- use tree structure of QTreeView
 - grouped items have a 'group_id' field
 - rename 'Normal' swap as 'Forward'
2020-06-22 11:26:49 +02:00
SomberNight
1ace265992
wallet: simplify get_payment_status 2020-06-21 08:23:07 +02:00
SomberNight
5f2d347d81
submarine_swaps: wallet.get_unused_address -> get_receiving_address 2020-06-18 17:11:14 +02:00
ThomasV
cb4c8abe1c submarine swaps: disable merging of transaction in history
This is too complicated and ugly because it relies on side
effects. What we should do instead is collapse transactions
in children nodes of QTreeView (see #6237)
2020-06-18 14:28:40 +02:00
ThomasV
a1e8f9e2aa swaps: mapping of prepay_hash to payment_hash 2020-06-18 14:28:40 +02:00
ThomasV
c8506eaa39 swaps: store fee_preimage 2020-06-18 14:28:40 +02:00
ThomasV
bcf2246633 minor fix 2020-06-18 14:28:40 +02:00
ThomasV
252591832a swaps: improve history display 2020-06-18 14:28:40 +02:00
ThomasV
f8dd62aec0 show swaps as single line in history
main_window.run_coroutine_from_thread
2020-06-18 14:28:40 +02:00
SomberNight
43892dd61a
invoices: fix #6233 2020-06-14 03:39:35 +02:00
SomberNight
0b224ba685
invoices: minor clean-up (type hints, mark broken things)
also rm some dead code
2020-06-13 18:54:22 +02:00
SomberNight
906a2c15dc
sweeping via CLI: allow customising RBF
fixes #6231
2020-06-13 18:44:20 +02:00
ghost43
947af92126
tx dialog: show various warnings if input amounts cannot be verified (#6217)
see #5749
2020-06-08 14:24:41 +00:00
SomberNight
7bcb59ffb5
wallet: when sweeping, do network reqs in parallel, and don't block GUI 2020-06-05 20:30:25 +02:00
ThomasV
d9747a2ff1 wallet fixes for lightning disabled (follow up 6058829870) 2020-06-05 15:04:33 +02:00
ThomasV
56f4932f10 import/exports to json files:
- fix #5737
 - add import/export or requests
2020-06-05 13:17:01 +02:00
SomberNight
309ba15745
invoices: follow-up fixes re clean-up
follow-up 6058829870 and related
2020-06-03 21:00:03 +02:00
matejcik
e058ee2957
psbt: always include full prev tx (#6198)
* enable streaming full UTXOs for all types of inputs

Co-authored-by: SomberNight <somber.night@protonmail.com>
2020-06-03 18:03:12 +00:00
ThomasV
cc3da6c75f follow-up prev 2020-06-03 18:48:27 +02:00
ThomasV
b6d56ece82 fix #6203: do not let request amount be None 2020-06-03 18:20:20 +02:00
ThomasV
6058829870 Use attr.s classes for invoices and requests:
- storage upgrade
 - fixes #6192
 - add can_pay_invoice, can_receive_invoice to lnworker
2020-06-01 21:02:45 +02:00
ThomasV
8e3ee73daf
Merge pull request #6134 from SomberNight/202004_ln_fundingtx_forbid_bump_cjoin
wallet: disallow fee-bumping/coinjoining ln funding tx
2020-05-27 18:37:04 +02:00
SomberNight
ac63444cfc
wallet: better handle used change addresses reverting to unused
If a used/reserved change address became unused/unreserved, it would not
get offered for usage by wallet until app restart.
Make the used->unused transition less likely by requiring 3 confirmations
(instead of considering even local/unconfirmed txs for 'used');
and avoid removing reserved addresses from the pool altogether.
2020-05-25 17:42:11 +02:00
SomberNight
c14a704082
wallet: fix minor locking thing in set_reserved_state_of_address
follow-up 6040e953a3
2020-05-25 17:34:52 +02:00
SomberNight
cdecc4e3fa
wallet: increase gap limit for change (6 -> 10)
We are now using change addresses for the channel SRK to_remote outputs
(and reserving these change addresses). (see prev commits)
Note that every channel open we initiate typically uses two change addresses:
- one for the SRK to_remote output, and
- one for the funding tx change output (assuming there is change).
2020-05-22 17:19:58 +02:00
SomberNight
6040e953a3
wallet: implement reserving addresses, and use it for LN SRK to_remote
- Use change addresses (instead of receive) for the static_remotekey to_remote outputs,
  and reserve these to greatly reduce the chance of address-reuse
- Use change addresses (instead of receive) for LN channel sweep addresses.
  Note that these atm are not getting reserved.
2020-05-22 17:19:51 +02:00
SomberNight
6457bb141d
wallet: (trivial) rename check_address 2020-05-22 17:19:48 +02:00
SomberNight
f8c574b699
wallet: (fix) get_receiving_address must always return an addr
- also, disallow deleting last address from an imported wallet (fixes #3254, fixes #4833)
- also, set LNBackups.sweep_address lazily, as during fresh wallet creation
  there are no addresses in the wallet at that point yet! see trace below.

Traceback (most recent call last):
  [...]
  File "...\electrum\electrum\tests\test_commands.py", line 112, in test_export_private_key_deterministic
    wallet = restore_wallet_from_text('bitter grass shiver impose acquire brush forget axis eager alone wine silver',
  File "...\electrum\electrum\wallet.py", line 2575, in restore_wallet_from_text
    wallet = Wallet(db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 2502, in __new__
    wallet = WalletClass(db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 2346, in __init__
    Deterministic_Wallet.__init__(self, db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 2147, in __init__
    Abstract_Wallet.__init__(self, db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 261, in __init__
    self.lnbackups = LNBackups(self)
  File "...\electrum\electrum\lnworker.py", line 1401, in __init__
    self.sweep_address = wallet.get_receiving_address()
  File "...\electrum\electrum\wallet.py", line 1498, in wrapper
    addr = func(self, *args, **kwargs)
  File "...\electrum\electrum\wallet.py", line 1520, in get_receiving_address
    raise Exception("no receiving addresses in wallet?!")
Exception: no receiving addresses in wallet?!
2020-05-22 16:25:33 +02:00
SomberNight
9657e927a7
wallet: (trivial) define import/delete_address in Abstract_Wallet 2020-05-22 16:17:41 +02:00
ThomasV
717d112b26 Move create_transaction logic from commands to wallet 2020-05-21 12:08:46 +02:00
ThomasV
6aeab66463 fix #6157 2020-05-11 08:12:09 +02:00
ThomasV
e2c2c89988 follow-up prev 2020-05-10 22:11:09 +02:00
ThomasV
13317c2f51 fix callback name: request_status 2020-05-10 21:14:31 +02:00
ThomasV
11aaa0b66f Simplify services (watchtower, payserver):
- Do not expose services settings in GUI
 - Use a single netaddress configuration variable.
2020-05-10 14:52:50 +02:00
SomberNight
2b1a150c52
multi-wallet: properly stop lnworker/lnwatcher 2020-05-01 04:50:08 +02:00
SomberNight
371cf1f445
wallet: disallow fee-bumping/coinjoining ln funding tx
related: #6127
2020-04-30 21:41:36 +02:00
SomberNight
54fdb011f9
fixups for CallbackManager refactor
9224404108
2020-04-24 15:32:05 +02:00
SomberNight
54e1520ee4
ln: check if chain tip is stale when receiving HTLC
if so, don't release preimage / don't forward HTLC
2020-04-13 17:04:27 +02:00
ThomasV
e2544b893a rm dead code: wallet.wait_until_synchronized 2020-04-11 15:26:29 +02:00