* Refactor away from post init for UPnP
* refactor UPnP to not be reusable
* update upnp in datalayer too
* add if_needed parameter to UPnP.shutdown()
* simpler
* be more lenient about startup failures, like before
* too many ways for UPnP to fail right now, revert to a smaller refactor approach instead of fixing them all up
* provide a skeleton hint protocol for rpc apis
* more
* more self.custom_get_connections = None
* fix RpcApiProtocol.service hinting
* catch up with RpcApiProtocol._state_changed()
* FullNode.server is now non-optional. 'ish
* drop another todo
* custom_get_connections -> get_connections
* just make get_connections() a mandatory method with a helper provided
* lots
* try again
* ._start_with_fingerprint()
* fill out the Service generic parameter in start scripts
* ... instead of pass
* add docstrings to the protocols
* remove no longer needed hasattr/not None checks
* remove outdated comment
* refactor Harvester._is_shutdown to ._shut_down
* util: Unify lockfile handling
This patch:
- Renames `util.lock.lock_by_path` to `util.lock.lock_path` and improves it by using `FileLock`
- Unifies all places where we create lock files to use `chia.util.lock.lock_path`
- Changes the daemon lockfile from `start-daemon.launching` to `daemon.lock` like we have it with all `<service>.lock` in the `run` folder
- Drops the `fastener` dependency
* Move the not keyring related sync tests into `test_lockfile.py`
* run pre-commit across platforms in ci
why? because we have developers working on multiple platforms.
* pre-clean for pre-commit in ci
* chia setup python action
* fixup
* fix windows specific hinting
* no TypeAlias yet
* debug
* debug
* adjust activated.ps1
* verbose pre-commit
* exit better
* Revert "debug"
This reverts commit 93a100afc7.
* less debug
* less `|`
* Update .pre-commit-config.yaml
* Update activated.ps1
* Simplify service start configuration loading
* oops
* more oops
* rename `config` to `service_config` as appropriate
* rename `full_config` to `config`
* new blob block api method integrated into wallet
* direct msg streaming of headers, rename, tests
* perform_handshake call fix
* updated trusted sync with new block header calls
* add max blocks limit to fetch
* added tests for rejected block header msgs
* avoid parsing transactions info if not required
* avoid looking up capabilities setting
* move block tests out of a class
* test fix
* Merge changes
* added docs and increased rate limits
* increased block header request interval from 32 to 128
* remove fetching hashes and use height range
* fetching by height in db v2
* update capabilities, other fixes
* fixed range block header call
* Add type hints
* Start work on optimizing fetch_last_tx_from_peer
* Huge speedup in trusted wallet sync
* Revert unintentional changes
* Fix trade issue
* Improve the code
* Str format
* Optimize handling of farming rewards
* Fix bug
* Performance fixes
* Optimizations to wallet syncing
* Don't return all coins in respond_additions
* Revert concurrency numbers
* More optimization of the caches
* Small optimization in coin_added
* Optimize request_additions significantly by using a cache
* fixes from feedback
* capabilities check fixes
* Increase rate limits to allow 250tps in verification requests
* Start work on rate limits
* New rate limit versioning support
* Revert unrelated changes
* revert return False
* Lint
* Revert cbi
* try tests with trusted peer
* Revert unrelated wallet changes
* Revert more debug changes
* Add test and throw on an error if not found
* Reject invalid requests
* Revert bad change with uint32, and change warning to info
* Parametrize wallet sync test
* Merge and LGTM
* More clean way to choose peers
* Fix lint
* add the new RejectBlockHeaders, RequestBlockHeaders and RespondBlockHeaders to the network protocol regression test and regenerate test files
* Rate limit diffs only
* Improve performance
* Simpler
* Lint
Co-authored-by: Sebastjan <trepca@gmail.com>
Co-authored-by: arvidn <arvid@libtorrent.org>
* port 0 to fix flakiness
* Try fixing setup_full_system
* Try fixing setup_full_system, and lint
* More attempts to fix
* No more calls to get random ports in setup_nodes
* Revert accidental changes
* Timelord extra arg
* Try with port 0
* Fix daemon test, and lint
* Try without 0.0.0.0
* Back to 0.0.0.0
* Try a few timelord changes to get test running
* Increase timeout again
* Use the correct interface to get the port
* INFO logging to debug issue
* Revert "INFO logging to debug issue"
This reverts commit 7c379e5cca.
* Fix advertised port log
* Add extra log
* Logging back
* Rollback the timelord changes
* Try port 0 timelord
* Revert "Try port 0 timelord"
This reverts commit 4997faf3b2.
* Try full green, change ordering
* Remove unused var
* speed up simulation and cleanup
* Now try without the port config
* Fix a flaky call to get_event_loop
* Try getting the port dynamically
* No dynamic port
* Try changing the ordering
* Try adding a sleep
* Back to what works
* Timelord before vdf clients
* Dynamic port for 1st timelord
* Revert "Dynamic port for 1st timelord"
This reverts commit 0f322a15b7.
* Revert "Timelord before vdf clients"
This reverts commit 3286c34696.
* Revert "Back to what works"
This reverts commit 30380dffb7.
* Revert "Try adding a sleep"
This reverts commit 9212b665a6.
* Revert "Try changing the ordering"
This reverts commit a62597d70d.
* Revert "No dynamic port"
This reverts commit 5d2e15749b.
* Revert "Try getting the port dynamically"
This reverts commit ef9cd75679.
* Revert "Fix a flaky call to get_event_loop"
This reverts commit 01a000fdfb.
* Try one to 0
* Just not 0
* Don't get port dynamically
* Cleanup a bit
* Fix
* Some cleanup work
* Some cleanup work
* Fix daemon test
* Cleanup
* Remove arguments
* Start fixing other issues
* Fork point, sync cancelling, random peer
* Reduce logging
* Improve performance and have a fallback peer for fetching
* Disconnect not synced peers
* Make sure try catch doesn't fail
* Fix lint
* Update chia/wallet/wallet_node.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Pylint has a bug so ignore pylint for this line
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* shutdown the weight proof process pool
* use a context manager for the weight proof process pool executor
* record of the debug code
* mostly cleaned up
* suppress sync task cancellation propagation when awaited while closing
* breakup multi-second WeightProofHandler.validate_weight_proof with async sleeps
* move awaiting of sync task until after existing cancellation
* properly handle shutdown file with a new instance each time and a context manager
* cleanup
* farmer: Run a start background task to wait if there are no keys yet
* farmer: Run the handshake in a background task if there are no keys yet
* tests: Yield the service in farmer/harvester setups
* tests: Introduce `start_service` in farmer/harvester setups
* server: Make `ChiaServer` and `Service` restartable
* tests: Test the delayed start/handshake in `test_farmer_harvester.py`
* tests: Move `test_farmer_harvester.py` to `tests/core/farmer_harvester`
Attempt to avoid issues due to the global block tools / shared keychain
between tests
* farmer: Return `bool` in `Farmer.setup_keys`
* tests: Add `__init__.py` to `tests/farmer_harvester`
* Address deficiency discussed in #8552, add ability to resolve to IPv6
addresses for hostnames.
* If there is no prefer_ipv6 in the config, set it True (per @hoffmang9)
and write it back to config.yaml
* Pass prefer_ipv6 flag to get_host_addr, which required a little digging
for it in a few places that call get_host_addr.
* Update a couple things for consistency
* Move the load_config into Wallet's __init__ so it doesn't get called so
many times as it would in has_full_node.
* Pass None into get_host_addr if there's no preference in config, so we have only that one place where the coded default lives. also fix an oversight where we were building a PeerInfo from a PeerInfo in some cases.
* Change the default here to match the default coded into util/network.py. It seems that github testers can't handle trying to use IPv6 and this may be easier for average users (sadly)
* A test to see if manually creating the server on :: (IP6_ANY) lets tests connect to localhost with IPv6 on
* Revert back to IPv4 default and remove the override inserted into
TCPSite for testing.
* Don't test for ip6-localhost, as it's not on all systems.
* Bah. Forced formatting of commented code...
* Add a type annotation for the addrset variable
* If we don't quote the socket enums, pylint gets upset because it has issues figuring out where/how they're defined. So, quote them here.
Co-authored-by: Chris Ross <cross+chia@distal.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* ignore signals in subprocesses
The sub-processes started by ProcessPoolExecutor will also receive SIGINT when the main process receives it. This results in the signal handler running in every subprocess and fail to create the task to close all connections. They print this error to stdout
* cleanup UPnP shutdown
make an explicit call to UPnP shutdown() (which joins the thread). Improve logging a bit
* wait for initialize_weight_proof task when shutting down
* release upnp ports on shutdown
* lint
* explicitly removes port mapping first to handle possible unclean shutdowns
* catches exception
* moves upnp setup to thread
* lint
* moves upnp logic to a message queue on a worker thread
* lint