diff --git a/ethportal-api/src/types/portal.rs b/ethportal-api/src/types/portal.rs index 584004ff2..4091bb162 100644 --- a/ethportal-api/src/types/portal.rs +++ b/ethportal-api/src/types/portal.rs @@ -25,13 +25,7 @@ pub struct PongInfo { pub data_radius: DataRadius, } -/// Response for FindNodes endpoint -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct FindNodesInfo { - pub total: u8, - pub enrs: Vec, -} +pub type FindNodesInfo = Vec; /// Response for FindContent endpoint #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ethportal-peertest/src/scenarios/basic.rs b/ethportal-peertest/src/scenarios/basic.rs index baf076e69..f4ce20abe 100644 --- a/ethportal-peertest/src/scenarios/basic.rs +++ b/ethportal-peertest/src/scenarios/basic.rs @@ -58,8 +58,7 @@ pub async fn test_history_find_nodes(target: &Client, peertest: &Peertest) { .find_nodes(peertest.bootnode.enr.clone(), vec![256]) .await .unwrap(); - assert_eq!(result.total, 1); - assert!(result.enrs.contains(&peertest.nodes[0].enr)); + assert!(result.contains(&peertest.nodes[0].enr)); } pub async fn test_history_find_nodes_zero_distance(target: &Client, peertest: &Peertest) { @@ -68,8 +67,7 @@ pub async fn test_history_find_nodes_zero_distance(target: &Client, peertest: &P .find_nodes(peertest.bootnode.enr.clone(), vec![0]) .await .unwrap(); - assert_eq!(result.total, 1); - assert!(result.enrs.contains(&peertest.bootnode.enr)); + assert!(result.contains(&peertest.bootnode.enr)); } pub async fn test_history_store(target: &Client) { diff --git a/trin-history/src/jsonrpc.rs b/trin-history/src/jsonrpc.rs index 5fc8036b4..dfd746645 100644 --- a/trin-history/src/jsonrpc.rs +++ b/trin-history/src/jsonrpc.rs @@ -217,14 +217,11 @@ async fn find_nodes( ) -> Result { let overlay = network.read().await.overlay.clone(); match overlay.send_find_nodes(enr, distances).await { - Ok(nodes) => Ok(json!(FindNodesInfo { - total: nodes.total, - enrs: nodes - .enrs - .into_iter() - .map(|enr| enr.into()) - .collect::>(), - })), + Ok(nodes) => Ok(json!(nodes + .enrs + .into_iter() + .map(|enr| enr.into()) + .collect::())), Err(msg) => Err(format!("FindNodes request timeout: {msg:?}")), } }