Commit Graph

12063 Commits

Author SHA1 Message Date
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
https://github.com/bitcoin/bitcoin/blob/99813a9745fe10a58bedd7a4cb721faf14f907a4/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
SomberNight 45a309ff25 qt channels_list: early exit if lightning is disabled
(note: signal is coming from a different wallet/window)

Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\channels_list.py", line 142, in do_update_single_row
    self.update_can_send(self.parent.wallet.lnworker)
  File "...\electrum\electrum\gui\qt\channels_list.py", line 164, in update_can_send
    msg = _('Can send') + ' ' + self.parent.format_amount(lnworker.can_send())\
AttributeError: 'NoneType' object has no attribute 'can_send'
2020-02-23 20:30:14 +01:00
SomberNight 614a38ae5c qt coin control status bar: don't defer 'Coins' tab updates
otherwise the cc sb only gets updated if tab when that tab is visible
2020-02-23 20:20:00 +01:00
SomberNight cc5624fb20 don't raise BaseException 2020-02-23 19:55:09 +01:00
SomberNight 2409782975 qt open channel: early return if fields are left empty
closes #5934
2020-02-23 19:53:41 +01:00
ThomasV ac884eb3c3 lnpeer: Use a single queue per channel for messages that are ordered.
Forward error messages with 'temporary_channel_id' to the correct channel_id
2020-02-23 18:06:47 +01:00
ThomasV 28c5825f41 follow-up previous commit 2020-02-23 17:56:01 +01:00
ThomasV 54ef6db762 do not try to reestablish channels in PREOPENING state (per BOLT2). 2020-02-23 14:54:04 +01:00
ThomasV 8730fa3f75 return preimage in lnpay. fixes #5794 2020-02-23 12:40:40 +01:00
ThomasV 67d0e780b3 remove double definition of lightning_history. fixes #5984 2020-02-23 11:59:34 +01:00
ThomasV 9616333b39 add_future_tx should return success 2020-02-22 17:20:05 +01:00
ThomasV 64a8de8bae Qt: show amounts sent to channels in show_transaction 2020-02-22 16:02:02 +01:00
ThomasV d319680d16 lnpeer: do not dump exceptions raised in initialize 2020-02-22 16:00:38 +01:00
ThomasV 874efc125d (minor) trigger 'wallet_updated' callback when adding future tx 2020-02-22 12:59:48 +01:00
ThomasV 7771daf94e qt: add menu item to view closing transaction of channel 2020-02-22 12:28:07 +01:00
ThomasV b12c913d47 do not show channel balances if channel is closed 2020-02-22 12:10:41 +01:00
ThomasV 4e73318fad Qt: ask confirmation before closing channel. 2020-02-22 10:40:39 +01:00
ThomasV 938d918e55 sweep_ctx: do not log if channel was not force closed 2020-02-22 09:27:34 +01:00
ThomasV 3264d19c6b Qt open channel dialog: suggest and clear buttons 2020-02-22 09:25:12 +01:00
ThomasV fa62d03c2a require option static_remotekey in lnwallet 2020-02-22 09:04:42 +01:00