mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
Data column sidecar event (#7587)
N/A Implement events for data column sidecar https://github.com/ethereum/beacon-APIs/pull/535
This commit is contained in:
@@ -11,6 +11,7 @@ pub struct ServerSentEventHandler<E: EthSpec> {
|
||||
single_attestation_tx: Sender<EventKind<E>>,
|
||||
block_tx: Sender<EventKind<E>>,
|
||||
blob_sidecar_tx: Sender<EventKind<E>>,
|
||||
data_column_sidecar_tx: Sender<EventKind<E>>,
|
||||
finalized_tx: Sender<EventKind<E>>,
|
||||
head_tx: Sender<EventKind<E>>,
|
||||
exit_tx: Sender<EventKind<E>>,
|
||||
@@ -37,6 +38,7 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
let (single_attestation_tx, _) = broadcast::channel(capacity);
|
||||
let (block_tx, _) = broadcast::channel(capacity);
|
||||
let (blob_sidecar_tx, _) = broadcast::channel(capacity);
|
||||
let (data_column_sidecar_tx, _) = broadcast::channel(capacity);
|
||||
let (finalized_tx, _) = broadcast::channel(capacity);
|
||||
let (head_tx, _) = broadcast::channel(capacity);
|
||||
let (exit_tx, _) = broadcast::channel(capacity);
|
||||
@@ -57,6 +59,7 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
single_attestation_tx,
|
||||
block_tx,
|
||||
blob_sidecar_tx,
|
||||
data_column_sidecar_tx,
|
||||
finalized_tx,
|
||||
head_tx,
|
||||
exit_tx,
|
||||
@@ -99,6 +102,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
.blob_sidecar_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count("blob sidecar", count)),
|
||||
EventKind::DataColumnSidecar(_) => self
|
||||
.data_column_sidecar_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count("data_column_sidecar", count)),
|
||||
EventKind::FinalizedCheckpoint(_) => self
|
||||
.finalized_tx
|
||||
.send(kind)
|
||||
@@ -177,6 +184,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
self.blob_sidecar_tx.subscribe()
|
||||
}
|
||||
|
||||
pub fn subscribe_data_column_sidecar(&self) -> Receiver<EventKind<E>> {
|
||||
self.data_column_sidecar_tx.subscribe()
|
||||
}
|
||||
|
||||
pub fn subscribe_finalized(&self) -> Receiver<EventKind<E>> {
|
||||
self.finalized_tx.subscribe()
|
||||
}
|
||||
@@ -249,6 +260,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
self.blob_sidecar_tx.receiver_count() > 0
|
||||
}
|
||||
|
||||
pub fn has_data_column_sidecar_subscribers(&self) -> bool {
|
||||
self.data_column_sidecar_tx.receiver_count() > 0
|
||||
}
|
||||
|
||||
pub fn has_finalized_subscribers(&self) -> bool {
|
||||
self.finalized_tx.receiver_count() > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user