From f6bfc9c867fac3fac062b5b452ef70d2df06f995 Mon Sep 17 00:00:00 2001 From: Izumi Hoshino Date: Thu, 1 Aug 2024 01:03:57 +0900 Subject: [PATCH] Fixed missing partial count was incorrectly incremented on solo plotNFT farming (#18346) * Fixed an issue where missing partial count was incorrectly incremented on solo plotNFT farming * Updated test --- chia/_tests/farmer_harvester/test_farmer.py | 9 +++++---- chia/farmer/farmer_api.py | 7 ++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/chia/_tests/farmer_harvester/test_farmer.py b/chia/_tests/farmer_harvester/test_farmer.py index 5376fd0b173b..fc09716d45d6 100644 --- a/chia/_tests/farmer_harvester/test_farmer.py +++ b/chia/_tests/farmer_harvester/test_farmer.py @@ -349,18 +349,19 @@ def test_increment_pool_stats(case: IncrementPoolStatsCase) -> None: "points_acknowledged_since_start": 0, "points_acknowledged_24h": [], "pool_errors_24h": [], - "valid_partials_since_start": 0, - "valid_partials_24h": [], + "valid_partials_since_start": 1, + "valid_partials_24h": [1], "invalid_partials_since_start": 0, "invalid_partials_24h": [], "insufficient_partials_since_start": 0, "insufficient_partials_24h": [], "stale_partials_since_start": 0, "stale_partials_24h": [], - "missing_partials_since_start": 1, - "missing_partials_24h": [1], + "missing_partials_since_start": 0, + "missing_partials_24h": [], }, ), + # Empty pool_url means solo plotNFT farming id="empty_pool_url", ), pytest.param( diff --git a/chia/farmer/farmer_api.py b/chia/farmer/farmer_api.py index 5388239bf34c..7d6b80692b8c 100644 --- a/chia/farmer/farmer_api.py +++ b/chia/farmer/farmer_api.py @@ -185,16 +185,13 @@ async def new_proof_of_space( pool_state_dict: Dict[str, Any] = self.farmer.pool_state[p2_singleton_puzzle_hash] pool_url = pool_state_dict["pool_config"].pool_url if pool_url == "": + # `pool_url == ""` means solo plotNFT farming increment_pool_stats( self.farmer.pool_state, p2_singleton_puzzle_hash, - "missing_partials", + "valid_partials", time.time(), ) - self.farmer.state_changed( - "failed_partial", - {"p2_singleton_puzzle_hash": p2_singleton_puzzle_hash.hex()}, - ) return if pool_state_dict["current_difficulty"] is None: