mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Add blob_sidecar event to SSE (#4790)
* Add `blob_sidecar` event to SSE. * Return 202 if a block is published but failed blob validation when validation level is `Gossip`. * Move `BlobSidecar` event to `process_gossip_blob` and add test. * Emit `BlobSidecar` event when blobs are received over rpc. * Improve test assertions on `SseBlobSidecar`s. * Add quotes to blob index serialization in `SseBlobSidecar` Co-authored-by: realbigsean <seananderson33@GMAIL.com> --------- Co-authored-by: realbigsean <seananderson33@GMAIL.com>
This commit is contained in:
@@ -4425,6 +4425,9 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
let receiver = match topic {
|
||||
api_types::EventTopic::Head => event_handler.subscribe_head(),
|
||||
api_types::EventTopic::Block => event_handler.subscribe_block(),
|
||||
api_types::EventTopic::BlobSidecar => {
|
||||
event_handler.subscribe_blob_sidecar()
|
||||
}
|
||||
api_types::EventTopic::Attestation => {
|
||||
event_handler.subscribe_attestation()
|
||||
}
|
||||
|
||||
@@ -199,9 +199,17 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlockConten
|
||||
if let Some(gossip_verified_blobs) = gossip_verified_blobs {
|
||||
for blob in gossip_verified_blobs {
|
||||
if let Err(e) = chain.process_gossip_blob(blob).await {
|
||||
return Err(warp_utils::reject::custom_bad_request(format!(
|
||||
"Invalid blob: {e}"
|
||||
)));
|
||||
let msg = format!("Invalid blob: {e}");
|
||||
return if let BroadcastValidation::Gossip = validation_level {
|
||||
Err(warp_utils::reject::broadcast_without_import(msg))
|
||||
} else {
|
||||
error!(
|
||||
log,
|
||||
"Invalid blob provided to HTTP API";
|
||||
"reason" => &msg
|
||||
);
|
||||
Err(warp_utils::reject::custom_bad_request(msg))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user