Return HTTP 202 to indicate processing error.

- A processing error of a validator's block or attestation should not prevent publishing. Now a 202 error is returned, to indicate that it has not been processed, but has still been published.
 - Added a publish_attestation function to the API, handling POST requests for /beacon/validator/attestation.
This commit is contained in:
Luke Anderson
2019-09-13 21:22:32 +10:00
parent 00a5f003c4
commit 23ce271b5f
4 changed files with 102 additions and 13 deletions

View File

@@ -140,7 +140,7 @@ impl<T: BeaconChainTypes> Service for ApiService<T> {
into_boxfut(validator::get_new_attestation::<T>(req))
}
(&Method::POST, "/beacon/validator/attestation") => {
into_boxfut(helpers::implementation_pending_response(req))
validator::publish_attestation::<T>(req)
}
(&Method::GET, "/beacon/state") => into_boxfut(beacon::get_state::<T>(req)),
@@ -164,6 +164,7 @@ impl<T: BeaconChainTypes> Service for ApiService<T> {
(&Method::GET, "/spec/eth2_config") => into_boxfut(spec::get_eth2_config::<T>(req)),
(&Method::GET, "/metrics") => into_boxfut(metrics::get_prometheus::<T>(req)),
_ => Box::new(futures::future::err(ApiError::NotFound(
"Request path and/or method not found.".to_owned(),
))),