Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,12 @@ pub fn serve<T: BeaconChainTypes>(
chain: Arc<BeaconChain<T>>| {
task_spawner.blocking_json_task(Priority::P1, move || {
let (root, execution_optimistic, finalized) = state_id.root(&chain)?;
Ok(root)
.map(api_types::RootData::from)
.map(api_types::GenericResponse::from)
.map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
Ok(api_types::GenericResponse::from(api_types::RootData::from(
root,
)))
.map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
})
},
);
Expand Down Expand Up @@ -1940,8 +1940,8 @@ pub fn serve<T: BeaconChainTypes>(
.naive_aggregation_pool
.read()
.iter()
.cloned()
.filter(|att| query_filter(&att.data)),
.filter(|&att| query_filter(&att.data))
.cloned(),
);
Ok(api_types::GenericResponse::from(attestations))
})
Expand Down Expand Up @@ -2318,11 +2318,9 @@ pub fn serve<T: BeaconChainTypes>(
task_spawner.blocking_json_task(Priority::P1, move || {
let (rewards, execution_optimistic, finalized) =
standard_block_rewards::compute_beacon_block_rewards(chain, block_id)?;
Ok(rewards)
.map(api_types::GenericResponse::from)
.map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
Ok(api_types::GenericResponse::from(rewards)).map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
})
},
);
Expand Down Expand Up @@ -2435,8 +2433,7 @@ pub fn serve<T: BeaconChainTypes>(
let execution_optimistic =
chain.is_optimistic_or_invalid_head().unwrap_or_default();

Ok(attestation_rewards)
.map(api_types::GenericResponse::from)
Ok(api_types::GenericResponse::from(attestation_rewards))
.map(|resp| resp.add_execution_optimistic(execution_optimistic))
})
},
Expand All @@ -2462,11 +2459,9 @@ pub fn serve<T: BeaconChainTypes>(
chain, block_id, validators, log,
)?;

Ok(rewards)
.map(api_types::GenericResponse::from)
.map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
Ok(api_types::GenericResponse::from(rewards)).map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
})
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ fn handle_error<T>(
Ok(None)
}
}
_ => Err(err).map_err(RPCError::from),
_ => Err(RPCError::from(err)),
}
}

Expand Down