Skip to content

Commit 9e89197

Browse files
committed
fix(rpc): move light node registry check inside target_id scope
Made-with: Cursor
1 parent 07065b8 commit 9e89197

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

  • development/qnet-integration/src

development/qnet-integration/src/rpc.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7844,37 +7844,37 @@ async fn handle_server_node_status(
78447844
"pending_rewards": pending_rewards
78457845
})));
78467846
}
7847-
}
7848-
7849-
// Not in active Super/Genesis list — check light_node_registry
7850-
if target_id.starts_with("light_") {
7851-
let registry = p2p.get_light_node_registry();
7852-
if let Some(node) = registry.get(target_id) {
7853-
let block_height = blockchain.get_height().await;
7854-
let pending_rewards = {
7855-
if let Some(wallet) = blockchain.get_node_wallet(target_id).await {
7856-
let state = blockchain.get_state_manager();
7857-
let state_guard = state.read().await;
7858-
(*state_guard).get_pending_rewards(&wallet)
7859-
} else {
7860-
0
7861-
}
7862-
};
7863-
return Ok(warp::reply::json(&json!({
7864-
"success": true,
7865-
"node_id": target_id,
7866-
"node_type": "Light",
7867-
"is_online": node.is_active,
7868-
"last_seen": node.last_seen,
7869-
"last_seen_ago_seconds": now.saturating_sub(node.last_seen),
7870-
"heartbeat_count": 0,
7871-
"required_heartbeats": 1,
7872-
"is_reward_eligible": node.is_active,
7873-
"reputation": null,
7874-
"current_block_height": block_height,
7875-
"needs_attention": !node.is_active,
7876-
"pending_rewards": pending_rewards
7877-
})));
7847+
7848+
// Not in active Super/Genesis list — check light_node_registry
7849+
if target_id.starts_with("light_") {
7850+
let registry = p2p.get_light_node_registry();
7851+
if let Some(node) = registry.get(target_id) {
7852+
let block_height = blockchain.get_height().await;
7853+
let pending_rewards = {
7854+
if let Some(wallet) = blockchain.get_node_wallet(target_id).await {
7855+
let state = blockchain.get_state_manager();
7856+
let state_guard = state.read().await;
7857+
(*state_guard).get_pending_rewards(&wallet)
7858+
} else {
7859+
0
7860+
}
7861+
};
7862+
return Ok(warp::reply::json(&json!({
7863+
"success": true,
7864+
"node_id": target_id,
7865+
"node_type": "Light",
7866+
"is_online": node.is_active,
7867+
"last_seen": node.last_seen,
7868+
"last_seen_ago_seconds": now.saturating_sub(node.last_seen),
7869+
"heartbeat_count": 0,
7870+
"required_heartbeats": 1,
7871+
"is_reward_eligible": node.is_active,
7872+
"reputation": null,
7873+
"current_block_height": block_height,
7874+
"needs_attention": !node.is_active,
7875+
"pending_rewards": pending_rewards
7876+
})));
7877+
}
78787878
}
78797879
}
78807880

0 commit comments

Comments
 (0)