Add more slot update notifications (#15734)
* Add more slot update notifications * fix merge * Address feedback and add integration test * switch to datapoint * remove unused shred method * fix clippy * new thread for rpc completed slots * remove extra constant * fixes * rely on channel closing * fix check
This commit is contained in:
@ -101,13 +101,63 @@ pub struct SlotInfo {
|
||||
pub root: Slot,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SlotTransactionStats {
|
||||
pub num_transaction_entries: u64,
|
||||
pub num_successful_transactions: u64,
|
||||
pub num_failed_transactions: u64,
|
||||
pub max_transactions_per_entry: u64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase", tag = "type")]
|
||||
pub enum SlotUpdate {
|
||||
OptimisticConfirmation { slot: Slot, timestamp: u64 },
|
||||
FirstShredReceived { slot: Slot, timestamp: u64 },
|
||||
Frozen { slot: Slot, timestamp: u64 },
|
||||
Root { slot: Slot, timestamp: u64 },
|
||||
FirstShredReceived {
|
||||
slot: Slot,
|
||||
timestamp: u64,
|
||||
},
|
||||
Completed {
|
||||
slot: Slot,
|
||||
timestamp: u64,
|
||||
},
|
||||
CreatedBank {
|
||||
slot: Slot,
|
||||
parent: Slot,
|
||||
timestamp: u64,
|
||||
},
|
||||
Frozen {
|
||||
slot: Slot,
|
||||
timestamp: u64,
|
||||
stats: SlotTransactionStats,
|
||||
},
|
||||
Dead {
|
||||
slot: Slot,
|
||||
timestamp: u64,
|
||||
err: String,
|
||||
},
|
||||
OptimisticConfirmation {
|
||||
slot: Slot,
|
||||
timestamp: u64,
|
||||
},
|
||||
Root {
|
||||
slot: Slot,
|
||||
timestamp: u64,
|
||||
},
|
||||
}
|
||||
|
||||
impl SlotUpdate {
|
||||
pub fn slot(&self) -> Slot {
|
||||
match self {
|
||||
Self::FirstShredReceived { slot, .. } => *slot,
|
||||
Self::Completed { slot, .. } => *slot,
|
||||
Self::CreatedBank { slot, .. } => *slot,
|
||||
Self::Frozen { slot, .. } => *slot,
|
||||
Self::Dead { slot, .. } => *slot,
|
||||
Self::OptimisticConfirmation { slot, .. } => *slot,
|
||||
Self::Root { slot, .. } => *slot,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
|
Reference in New Issue
Block a user