1
0
Commit Graph

13228 Commits

Author SHA1 Message Date
bitromortac
bd178fbed5 lnpeer: remove unused imports, code cleanup 2021-01-11 11:37:14 +01:00
bitromortac
e555ea650e lnpeer: add unit test for upfront shutdown script 2021-01-11 11:37:14 +01:00
bitromortac
673f89f0d2 scripts: add Lightning feature analysis script 2021-01-11 11:37:14 +01:00
bitromortac
5a72df2bb4 lnrater: suggest nodes compatible with our LN features 2021-01-11 11:37:14 +01:00
bitromortac
f7e5c2d3b0 lnworker: enable upfront shutdown script 2021-01-11 11:37:14 +01:00
bitromortac
6b90a2d36c lnpeer: implement upfront shutdown script logic
Upfront shutdown script is a script provided on channel opening,
which will be used by the peer to enforce us closing to this script
on collaborative channel close.
2021-01-11 11:37:14 +01:00
bitromortac
e5458bb534 wallet_db: migrate to upfront shutdown scripts 2021-01-11 11:37:14 +01:00
bitromortac
cf6e3e4efa lnwire: add upfront shutdown script tlvs 2021-01-11 11:37:14 +01:00
bitromortac
863fe031f0 lnpeer: await on_message handlers to raise exceptions 2021-01-11 11:36:38 +01:00
SomberNight
2eb02931ae hw plugins: log exception at import time (but only if interesting)
related: https://github.com/spesmilo/electrum/issues/6928
2021-01-11 00:05:23 +01:00
ThomasV
de903103da pass daemon to Commands instance in qt console. fixes #6926 2021-01-10 11:43:00 +01:00
SomberNight
2ec548dda3 ChannelDB: avoid duplicate (host,port) entries in ChannelDB._addresses
before:
node_id -> set of (host, port, ts)
after:
node_id -> NetAddress -> timestamp

Look at e.g. add_recent_peer; we only want to store
the last connection time, not all of them.
2021-01-09 19:56:05 +01:00
SomberNight
9a803cd1d6 ChannelDB: fix get_last_good_address 2021-01-09 18:41:41 +01:00
ghost43
b3a84e3137 Merge pull request #6922 from Coldcard/pr-v321
Export full derivation paths for Coldcard v3.2.1
2021-01-08 23:43:20 +00:00
Peter D. Gray
e829f2a0bc plugins/coldcard/coldcard.py: include derivation path for each part of multisig (for v3.2.1 of firmware) 2021-01-08 13:16:54 -05:00
Peter D. Gray
a810bc50be plugins/coldcard/README.md: updates and cleanup 2021-01-08 13:16:13 -05:00
SomberNight
922a48f2b7 rerun freeze_packages 2021-01-07 21:42:03 +01:00
SomberNight
9d1f1e9732 requirements: don't use dnspython 2.1 as it installs poetry at build-time
and poetry has a gazillion dependencies...

Collecting dnspython==2.1.0
  Downloading dnspython-2.1.0.zip (389 kB)
     |████████████████████████████████| 389 kB 2.1 MB/s
  Installing build dependencies ... |
error
  ERROR: Command errored out with exit status 1:
   command: /opt/electrum/contrib/build-linux/appimage/../../../contrib/build-linux/appimage/build/appimage/electrum.AppDir/usr/bin/python3.7 /opt/electrum/contrib/build-linux/appimage/build/appimage/electrum.AppDir/usr/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-5z1gx14i/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'poetry>=0.12'
       cwd: None
  Complete output (195 lines):
  Collecting poetry>=0.12
    Downloading poetry-1.1.4.tar.gz (132 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting pkginfo<2.0,>=1.4
    Downloading pkginfo-1.6.1.tar.gz (37 kB)
  Collecting tomlkit<1.0.0,>=0.7.0
    Downloading tomlkit-0.7.0.tar.gz (163 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting keyring<22.0.0,>=21.2.0; python_version >= "3.6" and python_version < "4.0"
    Downloading keyring-21.8.0.tar.gz (58 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting cleo<0.9.0,>=0.8.1
    Downloading cleo-0.8.1.tar.gz (19 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting pexpect<5.0.0,>=4.7.0
    Downloading pexpect-4.8.0.tar.gz (157 kB)
  Collecting poetry-core<2.0.0,>=1.0.0
    Using cached poetry-core-1.0.0.tar.gz (333 kB)
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting importlib-metadata<2.0.0,>=1.6.0; python_version < "3.8"
    Using cached importlib_metadata-1.7.0.tar.gz (29 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting crashtest<0.4.0,>=0.3.0; python_version >= "3.6" and python_version < "4.0"
    Downloading crashtest-0.3.1.tar.gz (4.3 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting shellingham<2.0,>=1.1
    Downloading shellingham-1.3.2.tar.gz (9.7 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting virtualenv<21.0.0,>=20.0.26
    Downloading virtualenv-20.2.2.tar.gz (9.1 MB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting requests-toolbelt<0.10.0,>=0.9.1
    Downloading requests-toolbelt-0.9.1.tar.gz (207 kB)
  Collecting html5lib<2.0,>=1.0
    Downloading html5lib-1.1.tar.gz (272 kB)
  Collecting cachecontrol[filecache]<0.13.0,>=0.12.4
    Downloading CacheControl-0.12.6.tar.gz (14 kB)
  Collecting clikit<0.7.0,>=0.6.2
    Downloading clikit-0.6.2.tar.gz (56 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting requests<3.0,>=2.18
    Downloading requests-2.25.1.tar.gz (102 kB)
  Collecting cachy<0.4.0,>=0.3.0
    Downloading cachy-0.3.0.tar.gz (15 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting packaging<21.0,>=20.4
    Downloading packaging-20.8.tar.gz (79 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting jeepney>=0.4.2; sys_platform == "linux"
    Downloading jeepney-0.6.0.tar.gz (49 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting SecretStorage>=3.2; sys_platform == "linux"
    Downloading SecretStorage-3.3.0.tar.gz (19 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting ptyprocess>=0.5
    Downloading ptyprocess-0.7.0.tar.gz (70 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting zipp>=0.5
    Using cached zipp-3.4.0.tar.gz (15 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Collecting appdirs<2,>=1.4.3
    Downloading appdirs-1.4.4.tar.gz (13 kB)
  Collecting distlib<1,>=0.3.1
    Downloading distlib-0.3.1.zip (578 kB)
  Collecting six<2,>=1.9.0
    Downloading six-1.15.0.tar.gz (33 kB)
  Collecting filelock<4,>=3.0.0
    Downloading filelock-3.0.12.tar.gz (8.5 kB)
  Collecting webencodings
    Downloading webencodings-0.5.1.tar.gz (9.7 kB)
  Collecting msgpack>=0.5.2
    Downloading msgpack-1.0.2.tar.gz (123 kB)
  Collecting lockfile>=0.9
    Downloading lockfile-0.12.2.tar.gz (20 kB)
      ERROR: Command errored out with exit status 1:
2021-01-07 21:41:58 +01:00
SomberNight
9e86bb171b binaries: update bundled PyQt version to 5.15.2
related: https://github.com/spesmilo/electrum/issues/6461#issuecomment-756240675
2021-01-07 21:41:46 +01:00
SomberNight
59a39af433 windows binaries: update libusb to 1.0.24 2021-01-07 18:53:09 +01:00
SomberNight
56d347a93b windows binaries: update pyinstaller to 4.1 2021-01-07 18:49:27 +01:00
SomberNight
d86138a1a5 storage: speed up write() by using faster compression setting
Re total runtime of WalletDB.write() and file size on disk,
for a large encrypted wallet, compare:

before (zlib level=6):
file size 16_670 KB
JsonDB.dump 0.5099 sec
zlib.compress 1.3280 sec
ECPubkey.encrypt_message 0.1720 sec

after change (zlib level=1):
file size 17_527 KB
JsonDB.dump 0.5344 sec
zlib.compress 0.5320 sec
ECPubkey.encrypt_message 0.1837 sec
2021-01-06 21:27:10 +01:00
Malcolm Smith
67ae678137 storage/db: use faster JSON encoder settings when wallet is encrypted
The standard json module has an optimized C encoder, but that doesn't
currently support indentation. So if you request indentation, it falls
back on the slower Python encoder.

Readability doesn't matter for encrypted wallets, so this disables
indentation when the wallet is encrypted.

-----

based on b2399b6a3e

For a large encrypted wallet, compare:
before change:
JsonDB.dump 1.3153 sec
zlib.compress 1.281 sec
ECPubkey.encrypt_message 0.1744 sec

after change:
JsonDB.dump 0.5059 sec
zlib.compress 1.3120 sec
ECPubkey.encrypt_message 0.1630 sec

Co-authored-by: SomberNight <somber.night@protonmail.com>
2021-01-06 21:14:56 +01:00
SomberNight
13c45bd798 qt send tab: mention frozen balance if "not enough funds" in more cases
fixes #6912
2021-01-06 03:05:13 +01:00
SomberNight
4b5616ff14 qt BlockingWaitingDialog: try harder to get label drawn (refresh bug) 2021-01-06 02:29:59 +01:00
SomberNight
85f76523b6 qt tx dialog: use WaitingDialog for network requests in __init__ 2021-01-06 02:27:17 +01:00
SomberNight
422f7ad110 qt tx dialog: fix visual artifact when opening (widget parenting issue) 2021-01-06 02:24:51 +01:00
ThomasV
177766ac37 lnpeer: fix a comment 2021-01-04 12:39:24 +01:00
ThomasV
07b08738a8 kivy wizard: checkum bip39 seeds, because the virtual keyboard imposes the English wordlist 2021-01-02 16:38:05 +01:00
ThomasV
b2ab2a9f6a wizard: call on_restore_seed, on_restore_bip39 through self.run. fixes #6895 2021-01-02 14:24:11 +01:00
ThomasV
77e0d3745e fix #4326 2021-01-02 11:48:15 +01:00
ThomasV
7e36770a06 fix #6605 2020-12-31 13:00:24 +01:00
ThomasV
eb6eac9254 fix reserve_sat in local_config. see #6896 2020-12-31 08:44:26 +01:00
ThomasV
d70431c0e7 lnchannel.available_to_spend: return zero if frozen or not active. Without this, the channel details window displays can_send/can_receive values that are inconsistent with the main window 2020-12-30 11:51:02 +01:00
ThomasV
b29cdc02da Require gossip_queries in LNWallet (follow-up f83d2d9fee)
- workaround lnd bug https://github.com/lightningnetwork/lnd/issues/3651
 - also reduces bandwidth usage
2020-12-28 15:41:42 +01:00
ThomasV
c478f3bb91 channel backups: fix exception in raised after channel is force closed
Traceback (most recent call last):
  File "/opt/electrum/electrum/util.py", line 1056, in wrapper
    return await func(*args, **kwargs)
  File "/opt/electrum/electrum/lnwatcher.py", line 183, in on_network_update
    await callback()
  File "/opt/electrum/electrum/lnwatcher.py", line 200, in check_onchain_situation
    keep_watching = await self.do_breach_remedy(funding_outpoint, closing_tx, spenders)
  File "/opt/electrum/electrum/lnwatcher.py", line 377, in do_breach_remedy
    sweep_info_dict = chan.sweep_ctx(closing_tx)
  File "/opt/electrum/electrum/lnchannel.py", line 227, in sweep_ctx
    our_sweep_info = self.create_sweeptxs_for_our_ctx(ctx)
  File "/opt/electrum/electrum/lnchannel.py", line 216, in create_sweeptxs_for_our_ctx
    return create_sweeptxs_for_our_ctx(chan=self, ctx=ctx, sweep_address=self.sweep_address)
  File "/opt/electrum/electrum/lnchannel.py", line 321, in sweep_address
    assert self.lnworker.wallet.is_mine(addr)
AssertionError
2020-12-27 18:11:42 +01:00
ThomasV
39fc72dad6 add paste button to qt payto_e. fixes #6878 2020-12-27 12:01:43 +01:00
SomberNight
112ad72cee qt: follow-up passing-around-config
follow-up b28b3994c7

E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 670, in new_wallet
    self.gui_object.start_new_window(full_path, None)
  File "...\electrum\electrum\gui\qt\__init__.py", line 245, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\gui\qt\__init__.py", line 269, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "...\electrum\electrum\gui\qt\__init__.py", line 311, in _start_wizard_to_select_or_create_wallet
    wizard.run('new')
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 153, in new
    self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 193, in on_wallet_type
    self.run(action)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 201, in choose_multisig
    self.multisig_dialog(run_next=on_multisig)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 200, in on_multisig
    self.run('choose_keystore')
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 225, in choose_keystore
    self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 275, in choose_hw_device
    self._choose_hw_device(purpose=purpose, storage=storage)
  File "...\electrum\electrum\base_wizard.py", line 358, in _choose_hw_device
    self.choice_dialog(title=title, message=msg, choices=choices,
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 359, in <lambda>
    run_next=lambda *args: self.on_device(*args, purpose=purpose, storage=storage))
  File "...\electrum\electrum\base_wizard.py", line 394, in on_device
    self.derivation_and_script_type_dialog(f)
  File "...\electrum\electrum\base_wizard.py", line 441, in derivation_and_script_type_dialog
    self.derivation_and_script_type_gui_specific_dialog(
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 393, in f
    self.run('on_hw_derivation', name, device_info, derivation, script_type)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 490, in on_hw_derivation
    self.on_keystore(k)
  File "...\electrum\electrum\base_wizard.py", line 592, in on_keystore
    self.run('show_xpub_and_add_cosigners', xpub)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 686, in show_xpub_and_add_cosigners
    self.show_xpub_dialog(xpub=xpub, run_next=lambda x: self.run('choose_keystore'))
  File "...\electrum\electrum\gui\qt\installwizard.py", line 106, in func_wrapper
    out = func(*args, **kwargs)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 700, in show_xpub_dialog
    layout = SeedLayout(xpub, title=msg, icon=False, for_seed_words=False)
  File "...\electrum\electrum\gui\qt\seed_dialog.py", line 108, in __init__
    self.seed_e = ShowQRTextEdit(config=self.config)
AttributeError: 'SeedLayout' object has no attribute 'config'
2020-12-23 17:34:21 +01:00
SomberNight
731756f6e8 dns hacks: use a default timeout of 30 sec for dns requests
dnspython changed the overall timeout for a request from 30 sec to 5 sec in version 2.0
(see 7ed1648b84 )

5 seconds is not enough in some network conditions...
We manually set the timeout back to 30 sec.

Note that in case these dns hacks are applied, and the timeout is reached,
we fallback to the system dns resolver, which hopefully can get a response.

-----

log was full of:

I | dns_hacks | dnspython failed to resolve dns (AAAA) for 'electrum.org' with error: Timeout('The DNS operation timed out after 5.000827789306641 seconds')
I | dns_hacks | dnspython failed to resolve dns (A) for 'electrum.org' with error: Timeout('The DNS operation timed out after 5.000998020172119 seconds')
I | dns_hacks | dnspython failed to resolve dns (AAAA) for 'electrum.hsmiths.com' with error: Timeout('The DNS operation timed out after 5.000227451324463 seconds')
I | dns_hacks | dnspython failed to resolve dns (A) for 'electrum.hsmiths.com' with error: Timeout('The DNS operation timed out after 5.000523328781128 seconds')
...
2020-12-22 10:48:10 +01:00
ThomasV
f83d2d9fee Move the part of process_gossip that requires access to channel_db into in LNGossip. 2020-12-21 13:33:34 +01:00
ghost43
7ab1a4552b Merge pull request #6867 from SomberNight/202012_wallet_rbf_fixes
wallet: fix bump_fee and dscancel for "not all inputs ismine" case
2020-12-20 14:31:47 +00:00
SomberNight
21f13e21b1 wallet: fix bump_fee and dscancel for "not all inputs ismine" case
we fetch the missing prev txs over network

fixes #6551
fixes #6864
2020-12-20 15:29:41 +01:00
SomberNight
b28b3994c7 qt: move window.get{Open,Save}FileName to util
Sometimes we want its "remember path" behaviour but it does not make sense to
parent the dialog from main window. When so, caller code no longer needs to
get a reference to a main window.

Also rm last usages of get_parent_main_window().
2020-12-20 15:25:35 +01:00
SomberNight
096d853482 qt: rm some usages of get_parent_main_window
instead, pass around the main window or config (whichever is actually needed)

fixes #6342
2020-12-20 15:25:31 +01:00
SomberNight
08c3d2ccd0 lnworker: follow-up 89a14996ce
this fixes running with --offline:

E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\channels_list.py", line 241, in do_update_rows
    items = [QtGui.QStandardItem(x) for x in self.format_fields(chan)]
  File "...\electrum\electrum\gui\qt\channels_list.py", line 82, in format_fields
    node_alias = self.lnworker.get_node_alias(chan.node_id)
  File "...\electrum\electrum\lnworker.py", line 188, in get_node_alias
    if self.channel_db:
AttributeError: 'LNWallet' object has no attribute 'channel_db'
2020-12-20 15:12:36 +01:00
ThomasV
6daf8b7534 kivy: show exception raised by lnworker.pay. fixes #6495 2020-12-20 11:30:18 +01:00
ThomasV
89a14996ce add method get_node_alias to lnworker 2020-12-19 15:10:15 +01:00
ThomasV
ae15bccb81 prepare release 4.0.9 4.0.9 2020-12-18 19:40:39 +01:00
SomberNight
bb41ef3450 wallet: (fix) bump_fee sometimes created invalid tx that spent orig out
When replacing non-segwit tx, bump_fee in some circumstances created
a tx that tried to spend from the tx-to-be-replaced. There is
explicit logic to avoid this but it only worked for segwit txs.

The change in transaction.py is a no-op, just tried to make it clearer
that the scriptSigs, witnesses are being reset by from_tx().
2020-12-18 19:35:22 +01:00
SomberNight
44e6bfbdd4 travis: disable macOS build 2020-12-18 19:15:45 +01:00