mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 19:34:37 +00:00
Add proposer preferences SSE event (#9308)
This is needed to connect to buildoor (Kurtosis package, acts as a trustless builder) Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
This commit is contained in:
@@ -29,6 +29,7 @@ pub struct ServerSentEventHandler<E: EthSpec> {
|
||||
execution_payload_gossip_tx: Sender<EventKind<E>>,
|
||||
execution_payload_available_tx: Sender<EventKind<E>>,
|
||||
execution_payload_bid_tx: Sender<EventKind<E>>,
|
||||
proposer_preferences_tx: Sender<EventKind<E>>,
|
||||
payload_attestation_message_tx: Sender<EventKind<E>>,
|
||||
}
|
||||
|
||||
@@ -60,6 +61,7 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
let (execution_payload_gossip_tx, _) = broadcast::channel(capacity);
|
||||
let (execution_payload_available_tx, _) = broadcast::channel(capacity);
|
||||
let (execution_payload_bid_tx, _) = broadcast::channel(capacity);
|
||||
let (proposer_preferences_tx, _) = broadcast::channel(capacity);
|
||||
let (payload_attestation_message_tx, _) = broadcast::channel(capacity);
|
||||
|
||||
Self {
|
||||
@@ -85,6 +87,7 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
execution_payload_gossip_tx,
|
||||
execution_payload_available_tx,
|
||||
execution_payload_bid_tx,
|
||||
proposer_preferences_tx,
|
||||
payload_attestation_message_tx,
|
||||
}
|
||||
}
|
||||
@@ -186,6 +189,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
.execution_payload_bid_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count("execution payload bid", count)),
|
||||
EventKind::ProposerPreferences(_) => self
|
||||
.proposer_preferences_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count("proposer preferences", count)),
|
||||
EventKind::PayloadAttestationMessage(_) => self
|
||||
.payload_attestation_message_tx
|
||||
.send(kind)
|
||||
@@ -284,6 +291,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
self.execution_payload_bid_tx.subscribe()
|
||||
}
|
||||
|
||||
pub fn subscribe_proposer_preferences(&self) -> Receiver<EventKind<E>> {
|
||||
self.proposer_preferences_tx.subscribe()
|
||||
}
|
||||
|
||||
pub fn subscribe_payload_attestation_message(&self) -> Receiver<EventKind<E>> {
|
||||
self.payload_attestation_message_tx.subscribe()
|
||||
}
|
||||
@@ -368,6 +379,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
|
||||
self.execution_payload_bid_tx.receiver_count() > 0
|
||||
}
|
||||
|
||||
pub fn has_proposer_preferences_subscribers(&self) -> bool {
|
||||
self.proposer_preferences_tx.receiver_count() > 0
|
||||
}
|
||||
|
||||
pub fn has_payload_attestation_message_subscribers(&self) -> bool {
|
||||
self.payload_attestation_message_tx.receiver_count() > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user