mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 02:24:23 -05:00
Added quality lookup time info to FarmingInfo (#15775)
This commit is contained in:
@@ -532,8 +532,8 @@ class FarmerAPI:
|
||||
msg = make_msg(ProtocolMessageTypes.request_signatures, request)
|
||||
await self.farmer.server.send_to_specific([msg], node_id)
|
||||
|
||||
@api_request()
|
||||
async def farming_info(self, request: farmer_protocol.FarmingInfo) -> None:
|
||||
@api_request(peer_required=True)
|
||||
async def farming_info(self, request: farmer_protocol.FarmingInfo, peer: WSChiaConnection) -> None:
|
||||
self.farmer.state_changed(
|
||||
"new_farming_info",
|
||||
{
|
||||
@@ -544,6 +544,8 @@ class FarmerAPI:
|
||||
"proofs": request.proofs,
|
||||
"total_plots": request.total_plots,
|
||||
"timestamp": request.timestamp,
|
||||
"node_id": peer.peer_node_id,
|
||||
"lookup_time": request.lookup_time,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -221,6 +221,7 @@ class HarvesterAPI:
|
||||
self.harvester.log.debug(f"new_signage_point_harvester {passed} plots passed the plot filter")
|
||||
|
||||
# Concurrently executes all lookups on disk, to take advantage of multiple disk parallelism
|
||||
time_taken = time.time() - start
|
||||
total_proofs_found = 0
|
||||
for filename_sublist_awaitable in asyncio.as_completed(awaitables):
|
||||
filename, sublist = await filename_sublist_awaitable
|
||||
@@ -239,6 +240,7 @@ class HarvesterAPI:
|
||||
await peer.send_message(msg)
|
||||
|
||||
now = uint64(int(time.time()))
|
||||
|
||||
farming_info = FarmingInfo(
|
||||
new_challenge.challenge_hash,
|
||||
new_challenge.sp_hash,
|
||||
@@ -246,13 +248,14 @@ class HarvesterAPI:
|
||||
uint32(passed),
|
||||
uint32(total_proofs_found),
|
||||
uint32(total),
|
||||
uint64(time_taken * 1_000_000), # nano seconds,
|
||||
)
|
||||
pass_msg = make_msg(ProtocolMessageTypes.farming_info, farming_info)
|
||||
await peer.send_message(pass_msg)
|
||||
found_time = time.time() - start
|
||||
|
||||
self.harvester.log.info(
|
||||
f"{len(awaitables)} plots were eligible for farming {new_challenge.challenge_hash.hex()[:10]}..."
|
||||
f" Found {total_proofs_found} proofs. Time: {found_time:.5f} s. "
|
||||
f" Found {total_proofs_found} proofs. Time: {time_taken:.5f} s. "
|
||||
f"Total {self.harvester.plot_manager.plot_count()} plots"
|
||||
)
|
||||
self.harvester.state_changed(
|
||||
@@ -262,7 +265,7 @@ class HarvesterAPI:
|
||||
"total_plots": self.harvester.plot_manager.plot_count(),
|
||||
"found_proofs": total_proofs_found,
|
||||
"eligible_plots": len(awaitables),
|
||||
"time": found_time,
|
||||
"time": time_taken,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class FarmingInfo(Streamable):
|
||||
passed: uint32
|
||||
proofs: uint32
|
||||
total_plots: uint32
|
||||
lookup_time: uint64
|
||||
|
||||
|
||||
@streamable
|
||||
|
||||
@@ -35,6 +35,7 @@ class HarvesterRpcApi:
|
||||
|
||||
if change == "farming_info":
|
||||
payloads.append(create_payload_dict("farming_info", change_data, self.service_name, "metrics"))
|
||||
payloads.append(create_payload_dict("farming_info", change_data, self.service_name, "wallet_ui"))
|
||||
|
||||
if change == "add_connection":
|
||||
payloads.append(create_payload_dict("add_connection", change_data, self.service_name, "metrics"))
|
||||
|
||||
@@ -125,6 +125,7 @@ farming_info = farmer_protocol.FarmingInfo(
|
||||
uint32(1390832181),
|
||||
uint32(908923578),
|
||||
uint32(2259819406),
|
||||
uint64(3942498),
|
||||
)
|
||||
|
||||
signed_values = farmer_protocol.SignedValues(
|
||||
|
||||
Binary file not shown.
@@ -49,6 +49,7 @@ farming_info_json: Dict[str, Any] = {
|
||||
"passed": 1390832181,
|
||||
"proofs": 908923578,
|
||||
"total_plots": 2259819406,
|
||||
"lookup_time": 3942498,
|
||||
}
|
||||
|
||||
signed_values_json: Dict[str, Any] = {
|
||||
|
||||
Reference in New Issue
Block a user