Commit Graph

151 Commits

Author SHA1 Message Date
SomberNight b1449a0a39 interface.got_disconnected: change from Future to Event
Events are far easier to reason about.
2021-01-21 03:11:15 +01:00
ln2max 42366ba57d network: increase MOST_RELAXED default timeout to 10 minutes
related: https://github.com/spesmilo/electrum/pull/6741
2020-12-16 11:02:09 +01:00
SomberNight e83f0dd3fc network: when switching servers, don't wait for old interface to close
The GUI blocks until network.set_parameters returns when switching servers,
which waits for switch_to_interface, which used to wait until interface.close()
returns. interface.close() tries to flush buffered writes to the wire, with a
30 sec timeout.

If the server or the network connection is slow, flushing the buffer can take
several seconds. In particular, servers running Fulcrum always seem to
timeout in this case, freezing the GUI for 30 seconds (when switching away).
2020-12-13 18:08:36 +01:00
SomberNight de80f68e4d interface: validate protocol-version negotiation on client-side too
related: https://github.com/romanz/electrs/issues/314
2020-11-03 20:45:31 +01:00
SomberNight 5481fd8af6 interface: validate field order in "mempool.get_fee_histogram" response 2020-10-26 02:07:30 +01:00
SomberNight c5da22a9dd network: tighten checks of server responses for type/sanity 2020-10-16 19:30:42 +02:00
bitromortac 292016d283 network dialog: include protocol in server address field (#6624)
* network-dialog: include protocol in server field

In this way it is now possible again to use plain server connections
without reverting it automatically to tls connections.

* qt network dialog: hide trailing protocol ":s" in TextEdit

This hides some complexity from casual users, while still allowing
advanced users to set the protocol.

Co-authored-by: SomberNight <somber.night@protonmail.com>
2020-10-14 16:28:31 +00:00
SomberNight aae06116f9 follow-up prev 2020-09-25 11:23:23 +02:00
SomberNight 5a7c3dc4d0 network: make MAX_INCOMING_MSG_SIZE configurable from config
requested in https://github.com/spesmilo/electrum/issues/4315#issuecomment-698730778
2020-09-25 11:15:04 +02:00
SomberNight d19ff43266 interface: check server response for some methods
some basic sanity checks

Previously if the server sent back a malformed response, it could partially corrupt a wallet file.
(as sometimes the response would get persisted, and issues would only arise later when the values were used)
2020-07-02 15:41:39 +02:00
SomberNight 3766420a0b network: clarify local_height/server_height 2020-06-21 08:20:56 +02:00
SomberNight 56a9ccca6d interface: make localhost exempt from ip-range bucketing 2020-04-25 06:38:26 +02:00
SomberNight 38980a4f5c interface: (trivial) make some methods private 2020-04-24 17:18:05 +02:00
Luke Childs ca1046bce2 Add --serverfingerprint option (#6094)
* Add --fingerprint option

* Simplify conditional checks

* Improve warning wording

* Throw error instead of logging and returning

* --fingerprint => --serverfingerprint

* Only run fingerprint checks against main server

* Throw error if --serverfingerprint is set for a non SSL main server

* Fix linting errors

* Don't check certificate fingerprint in a seperate connection

* Disallow CA signed certs when a fingerprint is provided

* Show clear error and then exit for Qt GUI users

* Remove leading newlines from error dialog

* Always check is_main_server() when getting fingerprint

* Document how to generate SSL cert fingerprint
2020-04-24 14:11:40 +00:00
SomberNight 9e57ae630b network/gui: unify host/port input fields to single server str
This allows optionally specifying the protocol for the main server.

fixes #6095
fixes #5278
2020-04-16 21:19:48 +02:00
SomberNight ea64b2af64 interface.get_certificate: use public asyncio APIs 2020-04-16 17:31:58 +02:00
SomberNight 223b62554e lntransport: use network proxy if available
fixes #4824
2020-04-15 21:44:09 +02:00
SomberNight cf1f2ba4dc network: replace "server" strings with ServerAddr objects 2020-04-15 17:23:47 +02:00
ThomasV 9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
ThomasV 133d74adfb fee estimates: use median if auto-connect 2020-03-12 15:39:50 +01:00
SomberNight ed234d3444 rename all TaskGroup() fields to "taskgroup"
for consistency
2020-02-27 19:13:56 +01:00
SomberNight e65ce96f9d interface: better error msg for main server re SSL cert issues
(logger.warning is shown even without -v, if there is a terminal)

closes #5884
2020-01-12 04:29:39 +01:00
SomberNight 0b0139c676 network.get_transaction: move some response validation logic from Synchronizer 2020-01-09 19:23:28 +01:00
SomberNight 787ac5fe99 interface: make changing max incoming msg size (1 MB) easier 2019-12-27 17:43:12 +01:00
SomberNight 24ebc77d76 ln chan verifier: fix code rot 2019-12-10 01:14:38 +01:00
SomberNight 68dad21fb4 network: make best_effort_reliable smarter and a bit more lenient
related: #5815
2019-12-01 23:24:43 +01:00
SomberNight a13344938f interface: fix connecting to raw IPv6 (as hostname) on Windows
Changed cert pinning filename as on Windows paths cannot contain a colon ':'.
2019-11-27 13:08:22 +01:00
SomberNight d430ec4bfc interface.deserialize_server: better ipv6 handling 2019-11-26 00:17:00 +01:00
SomberNight a10dc04b28 wallet: fix offline hw wallet signing when not specifying --offline
closes #5532
2019-07-29 13:27:37 +02:00
SomberNight 935ab9a12f interface: check if future already done in handle_disconnect
future could get cancelled in network.py in which case set_result raised
2019-06-28 21:13:33 +02:00
SomberNight 4fc43da344 interface.debug will now also print errors 2019-06-26 01:16:34 +02:00
SomberNight ab81a09de2 interface: hide some server-induced errors from log 2019-05-28 21:23:06 +02:00
SomberNight d17e6a1b87 interface: fix for aiorpcx 0.18 2019-05-28 06:14:53 +02:00
SomberNight 41f160dd74 update to aiorpcx 0.18 2019-05-27 19:35:30 +02:00
SomberNight eaf203dbb5 interface: fix connecting to new servers using self-signed certs
got broken in 6ec1578a90
2019-05-27 19:09:54 +02:00
SomberNight e1c1a9d6a2 interface: add comment 2019-05-25 05:20:21 +02:00
SomberNight a591ccf9b1 interface: follow-up 6ec1578a90 2019-05-22 17:43:33 +02:00
SomberNight 6ec1578a90 follow-up prev 2019-05-21 18:43:16 +02:00
SomberNight fecef91ee0 interface was suppressing storage r/w exceptions 2019-05-21 18:11:49 +02:00
SomberNight e8bc5bbec4 interface: follow-up 6cc70bc7a2 2019-05-15 19:56:16 +02:00
SomberNight 6cc70bc7a2 interface: when disconnecting due to RPCError, don't dump traceback 2019-05-14 15:58:02 +02:00
SomberNight 104b8804f7 logging: '-V' cli option can blacklist/whitelist classes with short names
for example, '-V ni' will whitelist the 'Network' and 'Interface' classes
'-V ^ni' will blacklist those instead
2019-05-07 21:07:18 +02:00
SomberNight 92ad7ec5c0 interface: use itertools.count 2019-05-07 17:24:00 +02:00
SomberNight 6940c424d1 logging: cli options to filter for modules using -v
old style "-v" still works

filtering examples:
-v=debug,network=error,interface=error      // effectively blacklists network and interface
-v=warning,network=debug,interface=debug    // effectively whitelists network and interface
2019-05-02 15:19:10 +02:00
SomberNight 3385a94753 logging: basics 2019-05-02 15:19:03 +02:00
SomberNight 556fa30ddf interface: partially fix ipv6 proxy
note that network.deserialize_proxy is still broken for ipv6
2019-05-02 12:04:06 +02:00
SomberNight 51e0672da6 update to aiorpcx 0.17 2019-04-30 21:24:39 +02:00
SomberNight c49d5f672c network: fix proxy case
follow-up "healty spread of servers" d8f3ab0917
2019-04-15 10:49:09 +02:00
SomberNight 2dca91d048 interface: better exception handling for _try_saving_ssl_cert_for_first_time 2019-04-12 22:49:34 +02:00
SomberNight d8f3ab0917 network: do not connect to multiple servers on same /16
maintain a healthy spread of (IP addresses of) connected servers
2019-04-12 22:32:36 +02:00