Commit Graph

272 Commits

Author SHA1 Message Date
Kyle Altendorf
ff5ef6e073
remove leading newlines from indented code blocks (#14653)
* remove leading newlines from indented code blocks

* catch another one
2023-02-23 21:53:48 -06:00
Kyle Altendorf
9e27220d27
avoid excessive logging filter registration (#14638) 2023-02-22 17:16:26 -06:00
Kyle Altendorf
c678f00acb
cleanup adjacent string literals (#14650) 2023-02-22 17:16:07 -06:00
dustinface
18e88e8476
types: Use IPAddress instead of str in PeerInfo (#14167)
* Use `IPAddress` instead of `str` in `PeerInfo`

* Add comment about `get_host_addr`
2023-02-22 12:03:41 -06:00
Kyle Altendorf
c71fcc0da0
handle ._get_extra_info() call on a closing connection (#14618)
* handle ._get_extra_info() call on a closing connection

* or just return none

* don't check if the transport is closing

* or have to catch an exception
2023-02-21 01:15:32 -06:00
Kyle Altendorf
261b799484
remove diagnostic assert 2023-02-14 23:16:53 +01:00
Kyle Altendorf
60331ad7df
ignore for pylint 2023-02-14 23:16:52 +01:00
Kyle Altendorf
3ba01ef177
at least a bit more specific 2023-02-14 23:16:51 +01:00
Kyle Altendorf
83d184c9d0
start fixing up windows hints 2023-02-14 23:16:49 +01:00
Amine Khaldi
cf147458e8
Merge commit '124961a355e6175037067a06f5f2ab18600dfdf1' into catchup/main_from_release_1.7.0_124961a355e6175037067a06f5f2ab18600dfdf1 2023-02-14 21:35:36 +01:00
Arvid Norberg
d315097b2a
full node optimizations (#14562)
implement async opt merge

Co-authored-by: William Allen <wallentx@users.noreply.github.com>
Co-authored-by: Florin Chirica <16658074+fchirica@users.noreply.github.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-02-13 22:34:31 -06:00
Adam Kelly
91655a9c0b
Rate limit 'Rate limiting' message (#14435) 2023-02-08 21:25:35 -06:00
Adam Kelly
a6ba031de7
Always Log service startup and shutdown. (#14447)
* Always Log service startup and shutdown. This is important information when trying to understand logfiles.

* typo
2023-02-07 18:22:20 -06:00
dustinface
3bd6069f04
server: Exclude some attributes from WSChiaConnection.__repr__ (#14466) 2023-02-04 14:14:27 -06:00
Sebastjan Trepca
d8d8660dbc
RPC call to reset wallet sync data (#14365)
* Add resync API

* Resolve comments

* Fix precommit

* set_wallet_resync RPC call

* disable resync after reset

* Update chia/wallet/wallet_node.py

Co-authored-by: Jeff <paninaro@gmail.com>

* fixes

* fixes

* rename method

* more tests, schema test

* removed formatting changes in initial-config

* another test case

* another test case

* simplification

* rename fix

* hinting

* added notification id table

---------

Co-authored-by: ytx1991 <t.yu@chia.net>
Co-authored-by: Jeff <paninaro@gmail.com>
2023-02-04 14:12:41 -06:00
Almog De Paz
3f97435159
dont announce none response capability to peers (#14386)
* dont announce none response capability to peers

* comment out none response handling

* skip test instead of comment out
2023-01-25 13:53:38 -06:00
Almog De Paz
e7e696af4a
add rate limits numbers to none response type (#14184) 2023-01-12 03:42:55 -06:00
Adam Kelly
199bbb912e
Try each Chia DNS Server in list before trying introducers (#14253)
* When looking for peers, try all DNS servers first, then try the introducer. Start from a random dns server each restart.

* Simplify randomizing dns server order
2023-01-10 18:56:17 -06:00
Kyle Altendorf
7caab0af58
Remove the rest of uvloop (#14191)
* Remove the rest of uvloop

The extra was removed at cc062976ea, should have removed the rest of the code too.

* isort
2023-01-06 16:59:28 -06:00
Kyle Altendorf
83900d7147
use .get("testing", False) to avoid errors when missing (#14267)
https://github.com/Chia-Network/chia-blockchain/issues/14239
2023-01-03 20:50:58 -06:00
Kyle Altendorf
d53f249e5c
only send_to_all(), drop send_to_all_except() (#14229)
* only send_to_all(), drop send_to_all_except()

* catch up tools/ as well

* add default
2023-01-02 21:39:11 -06:00
dustinface
4aadaeb7f1
server: Resolve peers in harvester and timelord startup also (#14161)
Fix missing host resolving in harvester and timelord startup process 
after https://github.com/Chia-Network/chia-blockchain/pull/14069.
2022-12-15 19:59:39 -06:00
dustinface
efba674564
server: Resolve config peers earlier (#14069) 2022-12-14 17:10:34 -06:00
Amine Khaldi
7defb1ebfc
Merge commit '618f93b4c42b176659cc74c02a4dd711adc62052' into checkpoint/main_from_release_1.6.2_618f93b4c42b176659cc74c02a4dd711adc62052 2022-12-14 19:24:34 +01:00
dustinface
d13f8b837f
server: Drop redundant VettedPeer.__init__ (#14123)
server: Drop unused `VettedPeer.__init__`
2022-12-13 09:52:21 -06:00
dustinface
fbc3127bd5
util: Rework get_host_addr (#14068)
* util: Rework `get_host_addr`

* Require `prefer_ipv6` to be named

* Remove outdated comment

* Improve result selection
2022-12-13 09:48:41 -06:00
Almog De Paz
b5f44027dd
don't throw unnecessary exception on peer connect (#14108)
don't throw unnecessary exception
2022-12-13 01:29:05 -06:00
dustinface
a40f04012b
server: Replace WSChiaConnection.__getattr__ with call_api (#14052) 2022-12-13 00:35:42 -06:00
Kyle Altendorf
618f93b4c4
handle incoming unknown capabilities (#14093)
* handle incoming unknown capabilities

* move it around

* chia.server.capabilities

* Update tests/util/test_network_protocol_files.py
2022-12-09 18:37:18 -06:00
dustinface
8a3ee3f4c0
server: Move api call processing into WSChiaConnection (#14008) 2022-12-09 03:47:46 -06:00
dustinface
5cc83b8af6
server: Some adjustments related to WSChiaConnection.close_event (#14039)
- Make it non-optional
- Make it private
- Only set it at the end of `WSChiaConnection.close`
2022-12-07 20:48:04 -06:00
Almog De Paz
4d068f284a
dont wait for timeout on None response (#13967)
* dont wait for timeout on None response

* handle return msg by type

* remove empty line

* isort

* improve reply check

* use map to check reply, add has_capability helper

* fix has_capability

* unused import
2022-12-07 20:47:21 -06:00
xdustinface
cd2589620e
Fix passing the error message to ban_peer_bad_protocol 2022-12-05 07:42:02 +01:00
xdustinface
c356fe0465
Fix ChiaServer.is_duplicate_or_self_connection 2022-12-05 07:41:56 +01:00
dustinface
bd36e0d308
server: Use closed property instead of the private member (#14022) 2022-11-29 12:18:33 -06:00
dustinface
898543b874
server: Enable and fix mypy for all chia.server files (#13990)
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-28 18:00:45 -06:00
dustinface
23ac4f7c80
server: Drop unused WSChiaConnection.is_feeler (#14011) 2022-11-28 13:57:01 -06:00
dustinface
f100101940
server: Some cleanup/refactoring in node_discovery.py (#14000)
* Drop unused parameter in `FullNodePeers`

* Adjust protocol message imports

* Use `PeerInfo` instead `Tuple[str, int]` as dict key

* Create the empty set earlier

* Refactor known peers cleanup
2022-11-25 00:39:06 -06:00
dustinface
6edb2ce01e
isort: Remove all chia.server exceptions and sort the related files (#13994) 2022-11-23 13:01:29 -06:00
dustinface
57a90bf24c
server: Compare PeerInfo in address_manager.py (#13991)
* server: Compare `PeerInfo` in `address_manager.py`

* Pass correct type to `AddressManager.attempt` in `test_cleanup`
2022-11-23 13:01:07 -06:00
dustinface
fbd83671c6
server: Drop unused code in FullNodeDiscovery (#13980) 2022-11-22 15:32:54 -06:00
dustinface
9b1989b014
Enable and fix mypy in server.py (#13579)
* server: Enable and fix `mypy` in `server.py`

* Add a comment about the `Message` hint

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Tweak assert message

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Make `name` non-optional

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Properly reject incoming connections to crawlers

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Hint `StreamResponse` and return the existing `WebSocketResonse`

* Raise if `remote` is `None`

* Restore old behaviour: succeed, don't fail for self connection

* Raise `HTTPInternalServerError` if `remote` is `None`

* Cast config values to `int`

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-18 10:43:14 -06:00
dustinface
e24263e21c
Reuse outbound_handshake (#13895) 2022-11-16 13:58:40 -06:00
dustinface
2ff987573d
Simplify ChiaServer.close_all_connections (#13916) 2022-11-16 13:57:30 -06:00
dustinface
5c861db42f
Make WSChiaConnection a dataclass (#13906)
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-16 13:38:28 -06:00
dustinface
643b29e636
Drop broken message types logging (#13914)
Seems like the idea was to log an overview of message types for the 
currently active api calls whenever we have multiples of 100 running. 
This currently isn't working at all because `len(message_types) % 100 == 
0` will only trigger if there are 100 different message types in the 
counter (we don't even have that much different messages). A fix would 
be to check `message_types.total() % 100 == 0`. But then, if we hover 
around 100 active messages this will repeatedly trigger logs since we 
decrement for each processed message, im not sure this all makes much 
sense and we anyway log all received message types with `DEBUG` logs so 
i decided to just drop this. If someone thinks we should keep it with 
the fix or has ideas to make this a more reasonable log instead of 
dropping it, let me know :)
2022-11-16 10:44:48 -06:00
Almog De Paz
ac2203eda8
Refactor test utils for import availability outside of repo (#13880)
* refactor for import availability outside of repo

* refactor for import availability outside of repo

* small revert

* newline

* fix imports

* fix pre-commit issues

* types issort, adapt mypy ignore

* redundant imports

* move files from util to simulator

* run pre_commit

* remove setup_nodes/keyring from isort.cfg

* fix asyncio import
2022-11-15 18:51:05 -06:00
dustinface
8e2e51a8c8
Add optional outbound parameter to get_connections (#13879) 2022-11-15 17:40:16 -06:00
Earle Lowe
f30f0b3512
Call close callback for already closed connections (#13727)
* always call close callback

* Some further explorations

* some more explorations

* Add delay while connections are closed in test

* Add a delay to make sure connections drain

* Update chia/server/server.py

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Update tests/connection_utils.py

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* use log_exceptions context manager

* set close flag correctly

* Added callback type and other changes

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-15 16:23:06 -06:00
dustinface
2706f5995b
server: Enable and fix mypy in ws_connection.py (#13878)
* server: Enable and fix `mypy` in `ws_connection.py`

* Apply suggestions from code review

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Tweak error message

* Tweak formatting

* Make `WSChiaConnection.close_callback` optional

* Tweak assert message

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Don't provide a default for `close_callback`

* Adjust assertion

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-12 14:18:11 -06:00