geyser: add parent slot/blockhash to block (#29855)
This commit is contained in:
parent
dde4b5d1ef
commit
b4d1769688
|
@ -2645,6 +2645,8 @@ impl ReplayStage {
|
|||
if let Some(ref block_metadata_notifier) = block_metadata_notifier {
|
||||
let block_metadata_notifier = block_metadata_notifier.read().unwrap();
|
||||
block_metadata_notifier.notify_block_metadata(
|
||||
bank.parent_slot(),
|
||||
&bank.parent_hash().to_string(),
|
||||
bank.slot(),
|
||||
&bank.last_blockhash().to_string(),
|
||||
&bank.rewards,
|
||||
|
|
|
@ -136,6 +136,8 @@ pub struct ReplicaBlockInfo<'a> {
|
|||
/// Extending ReplicaBlockInfo by sending the transaction_entries_count.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ReplicaBlockInfoV2<'a> {
|
||||
pub parent_slot: u64,
|
||||
pub parent_blockhash: &'a str,
|
||||
pub slot: u64,
|
||||
pub blockhash: &'a str,
|
||||
pub rewards: &'a [Reward],
|
||||
|
|
|
@ -23,6 +23,8 @@ impl BlockMetadataNotifier for BlockMetadataNotifierImpl {
|
|||
/// Notify the block metadata
|
||||
fn notify_block_metadata(
|
||||
&self,
|
||||
parent_slot: u64,
|
||||
parent_blockhash: &str,
|
||||
slot: u64,
|
||||
blockhash: &str,
|
||||
rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>,
|
||||
|
@ -39,6 +41,8 @@ impl BlockMetadataNotifier for BlockMetadataNotifierImpl {
|
|||
for plugin in plugin_manager.plugins.iter_mut() {
|
||||
let mut measure = Measure::start("geyser-plugin-update-slot");
|
||||
let block_info = Self::build_replica_block_info(
|
||||
parent_slot,
|
||||
parent_blockhash,
|
||||
slot,
|
||||
blockhash,
|
||||
&rewards,
|
||||
|
@ -91,6 +95,8 @@ impl BlockMetadataNotifierImpl {
|
|||
}
|
||||
|
||||
fn build_replica_block_info<'a>(
|
||||
parent_slot: u64,
|
||||
parent_blockhash: &'a str,
|
||||
slot: u64,
|
||||
blockhash: &'a str,
|
||||
rewards: &'a [Reward],
|
||||
|
@ -99,6 +105,8 @@ impl BlockMetadataNotifierImpl {
|
|||
executed_transaction_count: u64,
|
||||
) -> ReplicaBlockInfoV2<'a> {
|
||||
ReplicaBlockInfoV2 {
|
||||
parent_slot,
|
||||
parent_blockhash,
|
||||
slot,
|
||||
blockhash,
|
||||
rewards,
|
||||
|
|
|
@ -9,6 +9,8 @@ pub trait BlockMetadataNotifier {
|
|||
/// Notify the block metadata
|
||||
fn notify_block_metadata(
|
||||
&self,
|
||||
parent_slot: u64,
|
||||
parent_blockhash: &str,
|
||||
slot: u64,
|
||||
blockhash: &str,
|
||||
rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>,
|
||||
|
|
Loading…
Reference in New Issue