Commit graph

12082 commits

Author SHA1 Message Date
SomberNight
c8260249b0
lnworker: add own taskgroup (run in daemon.taskgroup) 2020-02-27 19:13:53 +01:00
ThomasV
0bf09d14a0 fix regression in shutdown (from 1c5dc79298) 2020-02-27 19:01:06 +01:00
ThomasV
34400c0710 Set channel state to OPENING as soon as we receive 'funding_signed',
instead of when the funding transaction has been broadcast, because
we have no reliable way to know when it will be broadcast.
2020-02-27 18:12:20 +01:00
ThomasV
d04b8c05e2 (minor) fix typo in comment 2020-02-27 14:48:08 +01:00
ThomasV
f5053cc242 follow-up e54c69b861: we must settle HTCLs after during shutdown 2020-02-27 14:40:58 +01:00
ThomasV
e159b1d468 test_close: add unsettled htlc (fails with the current code) 2020-02-27 13:41:40 +01:00
SomberNight
c744fc4e3d
follow-up prev: do all checks, and add tests 2020-02-27 05:13:31 +01:00
SomberNight
a987a2bbbe
keystore: make add_key_origin "API-user-friendly"
Power-users that know what they are doing can use this method
to populate key origin information for keystore (bip32 root fingerprint
and derivation path prefix).
Try to make method hard to misuse.

Qt console can now be used as e.g.:
```
wallet.get_keystores()[2].add_key_origin(derivation_prefix="m/48h/1h/0h/2h", root_fingerprint="deadbeef")
```

related #5715
related #5955
related #5969
2020-02-27 04:18:27 +01:00
SomberNight
bea038ea6b
Qt tx dialog: warn if user asked for full bip32 paths but info missing
related: https://github.com/spesmilo/electrum/issues/5969#issuecomment-591441399

Instead of a log line, maybe it should warn as part of the GUI.. but this is a start.
2020-02-27 03:31:14 +01:00
SomberNight
22861b70ee
Qt tx dialog: make "export with xpubs" option always available
not just if one of the keystores is a coldcard

related: https://github.com/spesmilo/electrum/issues/5969#issuecomment-591441399
2020-02-27 03:14:13 +01:00
SomberNight
6703521f56
rm more cruft from test_lnchannel
follow-up e54c69b861
2020-02-27 02:53:03 +01:00
SomberNight
6161853941
lnpeer: reduce log spam due to incompatible feature bits 2020-02-26 21:10:33 +01:00
SomberNight
e54c69b861
add lnchannel.can_send_ctx_updates. just drop illegal updates for now 2020-02-26 20:35:46 +01:00
SomberNight
9d1fa4cc99
(trivial) lnworker: move LNGossip.peer_closed to parent class 2020-02-26 20:31:51 +01:00
ThomasV
3d0c1dbd5c restore log lines for send_commitment, on_commitment_signed 2020-02-26 19:14:49 +01:00
ThomasV
87fe2c7d7a define channel.has_pending_changes method 2020-02-26 19:08:48 +01:00
ThomasV
1c5dc79298 shutdown:
- resend shutdown on reestablish
 - wait until no more pending updates before sending shutdown
2020-02-26 16:06:28 +01:00
ThomasV
9b97469598 (minor) follow-up previous commit 2020-02-26 15:49:55 +01:00
ThomasV
6833adf8b6 simplify previous commit (revert changes on transaction.py) 2020-02-26 14:16:21 +01:00
ThomasV
e85fb25146 lnpeer: verify signature in closing_signed 2020-02-26 12:58:40 +01:00
ThomasV
0848aa259d (minor) simplification 2020-02-26 11:30:19 +01:00
ThomasV
d5c03307c3 the funder sends the first 'closing_signed' message 2020-02-26 11:15:03 +01:00
SomberNight
9ab18ea6c9
transaction.deserialize: more sanity checks
this is mandated by consensus
99813a9745/src/consensus/tx_check.cpp (L13)
2020-02-25 21:14:41 +01:00
ghost43
28572197fb
Merge pull request #5992 from zebra-lucky/fix_spv_hash_merkle_root
fix SPV.hash_merkle_root, add tests/test_verifier.py
2020-02-25 19:56:27 +00:00
SomberNight
4f5f949979
follow-up prev
Clean up tests a bit, and rm some of them.
It's overkill to test with SPV._raise_if_valid_tx mocked out.
2020-02-25 20:45:17 +01:00
SomberNight
e9251c8e59
lnpeer: add "DO NOT TRUST..." remark to errors sent by remote
potential phishing...
2020-02-25 20:09:33 +01:00
SomberNight
6937b87a7c
transaction.BCDataStream: minor fixes
- fix read/write_boolean (though unused...)
- sanity check in read_bytes
2020-02-25 20:05:46 +01:00
zebra-lucky
c0be0471f2
fix BCDataStream.read_bytes (#5991)
* fix BCDataStream.read_bytes

* followup fix BCDataStream.read_bytes: fix TestBCDataStream.test_bytes
2020-02-25 18:58:03 +00:00
zebra-lucky
d4f7c207a7 fix SPV.hash_merkle_root, add tests/test_verifier.py 2020-02-25 20:06:11 +02:00
SomberNight
aaf174ef3e
lnpeer: cooperative close: verify scriptpubkey matches templates 2020-02-25 17:54:49 +01:00
Jakub Łukasiewicz
c121230706
Added ELECTRUMDIR env variable (#5543)
Simple way for allowing users to change localization of Electrum directory
from ~/.electrum to somewhere else
2020-02-25 15:28:53 +00:00
ThomasV
2927478192 lnpeer: closing fee negociation:
- use fee_rate from config
 - set upper bound on fee
 - add test_close to test_lnpeer
2020-02-25 15:23:15 +01:00
SomberNight
e7ab9e4054
lnpeer: await_remote/await_local now more restrictive, and docstring
Previously it was not so clear what these methods were doing.
2020-02-24 21:23:13 +01:00
SomberNight
5fda2cbb42
fix test: test_reestablish_with_old_state
Messages sent as part of the payment were getting interleaved with the channel_reestablish.
It does not actually make sense to do a payment and then reestablish the channel in the same transport -- the channel is supposed to already have been reestablished to do a payment in the first place.
So, after payment, strip down the transport, and set up a new transport before reestablishing.

Traceback (most recent call last):
  File "...\Python\Python38\lib\unittest\case.py", line 60, in testPartExecutor
    yield
  File "...\Python\Python38\lib\unittest\case.py", line 676, in run
    self._callTestMethod(testMethod)
  File "...\Python\Python38\lib\unittest\case.py", line 633, in _callTestMethod
    method()
  File "...\electrum\electrum\tests\test_lnpeer.py", line 262, in test_reestablish_with_old_state
    run(f())
  File "...\electrum\electrum\tests\test_lnpeer.py", line 302, in run
    return asyncio.run_coroutine_threadsafe(coro, loop=asyncio.get_event_loop()).result()
  File "...\Python\Python38\lib\concurrent\futures\_base.py", line 439, in result
    return self.__get_result()
  File "...\Python\Python38\lib\concurrent\futures\_base.py", line 388, in __get_result
    raise self._exception
  File "...\electrum\electrum\tests\test_lnpeer.py", line 260, in f
    await gath
  File "...\electrum\electrum\lnpeer.py", line 439, in _message_loop
    self.process_message(msg)
  File "...\electrum\electrum\lnpeer.py", line 159, in process_message
    execution_result = f(payload)
  File "...\electrum\electrum\lnpeer.py", line 1308, in on_revoke_and_ack
    chan.receive_revocation(rev)
  File "...\electrum\electrum\lnchannel.py", line 556, in receive_revocation
    raise Exception('revoked secret not for current point')
Exception: revoked secret not for current point
2020-02-24 21:09:34 +01:00
SomberNight
4a8ee1818a
follow-up prev
E/W | lnwatcher.LNWalletWatcher | Exception in on_network_update: AssertionError('None')
Traceback (most recent call last):
  File "...\electrum\electrum\util.py", line 1035, in wrapper
    return await func(*args, **kwargs)
  File "...\electrum\electrum\lnwatcher.py", line 174, in on_network_update
    await self.check_onchain_situation(address, outpoint)
  File "...\electrum\electrum\lnwatcher.py", line 184, in check_onchain_situation
    closing_height = self.get_tx_height(closing_txid)
  File "...\electrum\electrum\address_synchronizer.py", line 597, in get_tx_height
    verified_tx_mined_info = self.db.get_verified_tx(tx_hash)
  File "...\electrum\electrum\json_db.py", line 44, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\wallet_db.py", line 859, in get_verified_tx
    assert isinstance(txid, str), f"{repr(txid)}"
AssertionError: None
2020-02-24 18:52:33 +01:00
SomberNight
88658f9c2c
WalletDB: add type hints, and also corresponding asserts for sanity 2020-02-24 18:26:49 +01:00
SomberNight
931d961721
lnpeer/lnwatcher: include channel id in log lines 2020-02-24 16:32:18 +01:00
SomberNight
3966b51a94
fix undefined name 'CHANNEL_INIT_TIMEOUT' 2020-02-24 15:12:27 +01:00
SomberNight
a78583e5d4
travis: fix regtest 2020-02-24 14:52:19 +01:00
ThomasV
8ff1921c0d (minor) fix log 2020-02-24 13:23:11 +01:00
ThomasV
7908f4b203 follow-up previous commit 2020-02-24 13:02:11 +01:00
ThomasV
5785c2fa2f Fix #5975: Forget or redeem channels that are never funded.
- initiator: wait until double spent
 - non-initiator: wait until timeout
2020-02-24 12:45:10 +01:00
ThomasV
ed29a45d50 Qt: disable preview button in open_channel 2020-02-24 12:29:56 +01:00
ThomasV
20d8da7e24 db upgrade: store channel tx height and timestamps in 'channels' 2020-02-24 10:07:55 +01:00
ThomasV
e8ee4250d9 Do not save new channels before they are added to lnworker 2020-02-24 09:44:35 +01:00
SomberNight
8d02c2027c
travis: use more recent Ubuntu, get libsecp from Ubuntu apt (rm ppa) 2020-02-23 21:39:28 +01:00
SomberNight
84797f90d0
qt request_list: clear receive addr/req when hiding list 2020-02-23 21:23:56 +01:00
SomberNight
4c2e1970f2
qt receive tab: better "Clear" behaviour
Previously, the selection would not get cleared, and if the user clicked
again on the already selected item, the click would get ignored
(request would not get populated).
2020-02-23 21:18:46 +01:00
ThomasV
947211fe4e follow-up 54ef6db762: set channel state to OPENING if funding tx was broadcast later (e.g. cold storage) 2020-02-23 20:43:23 +01:00
SomberNight
36629f0957
cosigner_pool plugin: don't show button in tx dialog before finalizing
(previously button would be shown for a watch-only multisig wallet)
2020-02-23 20:38:57 +01:00