mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
Add inclusion list sse event
This commit is contained in:
@@ -1144,6 +1144,7 @@ pub enum EventKind<E: EthSpec> {
|
||||
AttesterSlashing(Box<AttesterSlashing<E>>),
|
||||
BlsToExecutionChange(Box<SignedBlsToExecutionChange>),
|
||||
BlockGossip(Box<BlockGossip>),
|
||||
InclusionList(Box<SignedInclusionList<E>>),
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EventKind<E> {
|
||||
@@ -1168,6 +1169,7 @@ impl<E: EthSpec> EventKind<E> {
|
||||
EventKind::AttesterSlashing(_) => "attester_slashing",
|
||||
EventKind::BlsToExecutionChange(_) => "bls_to_execution_change",
|
||||
EventKind::BlockGossip(_) => "block_gossip",
|
||||
EventKind::InclusionList(_) => "inclusion_list",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1254,6 +1256,11 @@ impl<E: EthSpec> EventKind<E> {
|
||||
"block_gossip" => Ok(EventKind::BlockGossip(serde_json::from_str(data).map_err(
|
||||
|e| ServerError::InvalidServerSentEvent(format!("Block Gossip: {:?}", e)),
|
||||
)?)),
|
||||
"inclusion_list" => Ok(EventKind::InclusionList(
|
||||
serde_json::from_str(data).map_err(|e| {
|
||||
ServerError::InvalidServerSentEvent(format!("Inclusion List {:?}", e))
|
||||
})?,
|
||||
)),
|
||||
_ => Err(ServerError::InvalidServerSentEvent(
|
||||
"Could not parse event tag".to_string(),
|
||||
)),
|
||||
@@ -1290,6 +1297,7 @@ pub enum EventTopic {
|
||||
ProposerSlashing,
|
||||
BlsToExecutionChange,
|
||||
BlockGossip,
|
||||
InclusionList,
|
||||
}
|
||||
|
||||
impl FromStr for EventTopic {
|
||||
@@ -1316,6 +1324,7 @@ impl FromStr for EventTopic {
|
||||
"proposer_slashing" => Ok(EventTopic::ProposerSlashing),
|
||||
"bls_to_execution_change" => Ok(EventTopic::BlsToExecutionChange),
|
||||
"block_gossip" => Ok(EventTopic::BlockGossip),
|
||||
"inclusion_list" => Ok(EventTopic::InclusionList),
|
||||
_ => Err("event topic cannot be parsed.".to_string()),
|
||||
}
|
||||
}
|
||||
@@ -1343,6 +1352,7 @@ impl fmt::Display for EventTopic {
|
||||
EventTopic::ProposerSlashing => write!(f, "proposer_slashing"),
|
||||
EventTopic::BlsToExecutionChange => write!(f, "bls_to_execution_change"),
|
||||
EventTopic::BlockGossip => write!(f, "block_gossip"),
|
||||
EventTopic::InclusionList => write!(f, "inclusion_list",),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user