1
0
Commit Graph

14050 Commits

Author SHA1 Message Date
Jeremy Rand
d79de7ac2e Cirrus: Use VM instead of Docker for functional tests 2021-12-28 07:04:57 +00:00
ThomasV
bdbd59300f Prepare scripts for aggregated signatures:
- fetch file signatures in contrib/add_cosigner.
 - detect cosigners in make_download.
 - format download page for aggregated signatures.
2021-12-19 17:10:41 +01:00
ThomasV
195b470d70 contrip/upload: do not fail sftp if directory already exists 2021-12-19 17:02:27 +01:00
SomberNight
7354feeffe follow-up fix tests: logic typo
follow-up https://github.com/spesmilo/electrum/pull/7202

defaultdict[int] is a type!

```
>>> from collections import defaultdict
>>> d = defaultdict[int]
>>> d[2]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: There are no type variables left in collections.defaultdict[int]
```

Also, prior to py3.9, it is a TypeError.
2021-12-17 15:21:21 +01:00
ghost43
c8f47ed4fe Merge pull request #7562 from SomberNight/202111_blockchain_target
blockchain.py: bugfixes re `bits_to_target` and `target_to_bits`
2021-12-17 14:07:55 +00:00
ghost43
ce44a03c24 Merge pull request #7202 from bitromortac/2104-mpp-channel-splitting
MPP splitting algorithm: redesign and split within channels
2021-12-17 13:58:54 +00:00
ghost43
97e61cfacd Merge pull request #7590 from matejcik/matejcik/trezorlib-0.13
trezorlib 0.13 compatibility
2021-12-17 12:05:35 +00:00
upgradvisor-bot
a044d7df01 Update qdarkstyle to <3.1 (allow 3.0.x) (#7561)
Co-authored-by: the-new-kai-lu <freddylukai@gmail.com>
2021-12-17 11:50:48 +00:00
ThomasV
0eebf9df43 Merge pull request #7588 from bitromortac/2112-fix-closing-to-remote
lnpeer: fix possibly nonexistant to_remote check
2021-12-17 12:45:45 +01:00
Pavol Rusnak
1e8e2890d5 trezor: use the same amount unit (satoshi, etc.) on device 2021-12-13 14:30:27 +01:00
matejcik
9a975a5200 trezorlib 0.13 compatibility 2021-12-09 13:55:03 +01:00
bitromortac
ffba3fb7fc lnpeer: fix possibly nonexistant to_remote check
`drop_to_remote` can be False and at the same time the to_remote output
is not present, because it is below dust. Therefore, we have to explicitly
check if to_remote is present when checking for the allowed script types and
dust limits. This affects channels which have sent only dust values, they
can't be closed unilaterally without this fix.

Fixes a regression introduced by 947693c90d.
2021-12-08 14:23:55 +01:00
SomberNight
0df05dd914 qt preferences: always show cb for LN/"Create recoverable channels"
This makes it explicit that the option cannot be enabled if so (instead of hiding the checkbox).
2021-11-17 17:54:52 +01:00
SomberNight
62e1d8ed78 daemon: (trivial) subservices log when they start listening 2021-11-15 17:43:34 +01:00
SomberNight
2f2821f9ee qt tray tooltip: don't include wallet balance
closes https://github.com/spesmilo/electrum/issues/5665
2021-11-15 16:57:40 +01:00
SomberNight
7e2d9c48d1 blockchain: fix bugs in bits_to_target and target_to_bits
This fixes three bugs:
- too large targets: the fixme in target_to_bits, which meant that we could
  not handle targets where the first bit was non-zero. This however cannot
  happen due to these being over MAX_TARGET. (difficulty 1)
- too small targets: in bits_to_target, very small targets were not handled well:
  ```
  >>> Blockchain.bits_to_target(0x03008000)
  32768
  ```
  We could not process headers with targets smaller than the above value.
  (note that these small targets would only occur at astronomically high mining difficulty)
- non-canonically encoded targets:
  we would not accept headers that had targets encoded in compact form (nBits) in a non-canonical way.
  I think this bug could actually be triggered by mining such a header.
  E.g. consider the target "1167130406913723784571467005534932607254396928"
  ```
  Blockchain.target_to_bits(1167130406913723784571467005534932607254396928).to_bytes(4, "big").hex()
  '13345600'
  ```
  Bitcoin Core when used to e.g. mine a block would encode this target as 0x13345600 in compact form.
  However, AFAICT, when validating Bitcoin Core would equally accept 0x14003456 which decodes to the
  same target. We were however rejecting such non-canonical compact nBits.
  ```
  >>> from electrum.blockchain import Blockchain
  >>> Blockchain.bits_to_target(0x14003456)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/user/wspace/electrum/electrum/blockchain.py", line 548, in bits_to_target
      raise Exception("Second part of bits should be in [0x8000, 0x7fffff]")
  Exception: Second part of bits should be in [0x8000, 0x7fffff]
  >>> Blockchain.bits_to_target(0x13345600)
  1167130406913723784571467005534932607254396928
  ```
2021-11-13 04:31:08 +01:00
SomberNight
ee10e8e4d3 blockchain: bits_to_target: small clean-up
note: why is the first byte cut unconditionally? what if it's non-zero?
Maybe the intention of cutting the first two chars in the hex case intended to
cut a "0x" prefix?? But there was no such prefix with the given format string...
2021-11-13 03:07:36 +01:00
SomberNight
6033471853 blockchain: clarify MAX_TARGET by referencing bitcoin core source
change is no-op as the compact nBits form of both values are equal, that is:
```
>>> from electrum.blockchain import Blockchain
>>> MAX_TARGET1 = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
>>> MAX_TARGET2 = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
>>> Blockchain.bits_to_target(Blockchain.target_to_bits(MAX_TARGET2)) == Blockchain.bits_to_target(Blockchain.target_to_bits(MAX_TARGET1))
True
```
2021-11-13 03:02:31 +01:00
SomberNight
2599010eed interface: scripthash.get_history: fix tx order check
logic bug
2021-11-11 15:28:16 +01:00
SomberNight
88a1c1a618 python 3.10: fix some deprecation warnings and compat with 3.10 2021-11-09 01:02:57 +01:00
SomberNight
ed0dd6eb22 kivy: implement ElectrumGui.stop 2021-11-05 20:35:28 +01:00
SomberNight
ca9b48e2d6 gui: add BaseElectrumGui base class for guis 2021-11-05 20:21:50 +01:00
SomberNight
c331c311db crash reporter: add EarlyExceptionsQueue
`util.send_exception_to_crash_reporter` is now useful and can be transparently
used even before the exception hook is set up.
2021-11-05 20:01:43 +01:00
SomberNight
e0246b30b9 daemon: if taskgroup dies, show error in GUI
If daemon.taskgroup dies
- in GUI mode, show a crash reporter window to the user,
  instead of immediately stopping the whole process.
- in daemon mode, log exception and stop process, as before.
2021-11-05 20:01:38 +01:00
SomberNight
3643b9f056 daemon: rework stopping
The CLI stop() command can now also stop the GUI.
2021-11-05 19:57:39 +01:00
ghost43
a5c4b9e719 Merge pull request #7545 from yanmaani/unix_sockets
Add support for Unix domain sockets
2021-11-04 19:32:33 +01:00
SomberNight
56b03e2e8d lnpeer: more forwarding is now event-driven
This should make unit tests less reliant on sleeps.
2021-11-04 19:16:02 +01:00
SomberNight
12f3525df0 lnpeer: disable msg processing rate-limiting in tests 2021-11-04 18:04:16 +01:00
SomberNight
4f907e3889 lnworker: change api of 'htlc_{fulfilled,failed}' events 2021-11-04 16:41:23 +01:00
SomberNight
16c6655892 lnpeer: make forwarding partly event-driven 2021-11-04 16:32:40 +01:00
yanmaani
82b9cd12eb tests: Add rudimentary integration test for Unix domain socket functionality 2021-11-03 12:00:00 +00:00
yanmaani
b1005694ec cli: Add support for Unix domain sockets 2021-11-03 12:00:00 +00:00
SomberNight
f066f25a30 win build: revert pyinstaller upgrade
Various issues with newer versions... needs more investigation.

This reverts part of 2b4bf19c06
2021-11-03 04:07:52 +01:00
SomberNight
2b4bf19c06 win build: update some build dependencies 2021-11-02 18:38:28 +01:00
SomberNight
7d5c5b75a1 android build: bump python 3.8.8->3.8.12 2021-11-02 18:38:24 +01:00
SomberNight
7409a32879 win build: bump python 3.8.8->3.9.7 2021-11-02 18:38:21 +01:00
SomberNight
f01ca726e4 mac build: bump python 3.7.9->3.9.7 2021-11-02 18:38:17 +01:00
SomberNight
6a0d7dfd48 rerun freeze_packages 2021-11-02 18:38:13 +01:00
SomberNight
d67e24438e lnsweep: rm code dupe: 2nd stage htlc tx out vs ctx to_local addr reuse 2021-11-01 18:05:33 +01:00
SomberNight
99836d5e5f kivy: confirm_tx_dialog: toggling "final" should update the tx
We create a tx when the dialog is created, and re-create it every time
the user moves the fee slider. However, we were not re-creating it if
the user toggles the "Final" checkbox, meaning its value was only taken
into account if the user moved the fee slider after setting the checkbox.

fixes https://github.com/spesmilo/electrum/issues/7547
2021-10-29 14:27:13 +02:00
ghost43
5787f3ab74 Merge pull request #7542 from bitromortac/2109-dust-limit
Implement recent spec changes regarding collab channel close outputs
2021-10-27 16:51:07 +02:00
SomberNight
cb55a2d654 tests: try to reduce flakyness of test_fail_pending_htlcs_on_shutdown
Alice sends and HTLC: Alice->Carol->Dave
we need a lot of messages back and forth to happen:
- Alice adds HTLC to chan_AC, sends sig, Carol revacks, sends sig, Alice revacks;
- only then Carol adds HTLC to chan_CD, sends sig, Dave revacks, sends sig, Carol revacks
on CI, 0.5 seconds is often not enough for this it seems.
2021-10-27 16:46:15 +02:00
bitromortac
e97f350597 add comment for safer forwarding 2021-10-27 16:27:16 +02:00
bitromortac
947693c90d check dust limits
* on channel opening we verify that the peer's dust limit is above 354
  sat, the limit for unknown segwit versions
* we constrain the allowed scriptpubkey types for channel closing
* we check that the remote's output is above the relay dust limit for
  the collaborative close case
2021-10-27 16:27:15 +02:00
bitromortac
f2f8c4533b implement option_shutdown_anysegwit
https://github.com/lightningnetwork/lightning-rfc/pull/672

We check the received shutdown script against higher segwit versions and
accept closing to that script if option_shutdown_anysegwit has been
negotiated.
2021-10-26 14:51:09 +02:00
SomberNight
5c91212fab dns hacks: dns via proxy: special-case "localhost" string
fix https://github.com/spesmilo/electrum/issues/7546
2021-10-25 17:46:51 +02:00
SomberNight
1ff9f9910f ln update_fee: enforce that feerate is over default min relay fee
(this was always already the case when we are the funder, but we were
not checking it when remote is responsible for update_fee)
2021-09-28 19:48:31 +02:00
SomberNight
4af103378a lnpeer: refactor some checks re open_channel/accept_channel 2021-09-28 19:48:27 +02:00
ghost43
437a9e4358 Merge pull request #7505 from bitromortac/2109-activate-watchtower
watchtower: continuously check for added channels
2021-09-28 16:46:19 +02:00
SomberNight
b9295eda09 ci: only run coveralls script if ENV var is set (for token)
As the token is typically not available for pull requests.
2021-09-28 16:30:41 +02:00