geyser: add parent slot/blockhash to block (#29855)

This commit is contained in:
Kirill Fomichev 2023-01-25 19:20:24 -03:00 committed by GitHub
parent dde4b5d1ef
commit b4d1769688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View File

@ -2645,6 +2645,8 @@ impl ReplayStage {
if let Some(ref block_metadata_notifier) = block_metadata_notifier { if let Some(ref block_metadata_notifier) = block_metadata_notifier {
let block_metadata_notifier = block_metadata_notifier.read().unwrap(); let block_metadata_notifier = block_metadata_notifier.read().unwrap();
block_metadata_notifier.notify_block_metadata( block_metadata_notifier.notify_block_metadata(
bank.parent_slot(),
&bank.parent_hash().to_string(),
bank.slot(), bank.slot(),
&bank.last_blockhash().to_string(), &bank.last_blockhash().to_string(),
&bank.rewards, &bank.rewards,

View File

@ -136,6 +136,8 @@ pub struct ReplicaBlockInfo<'a> {
/// Extending ReplicaBlockInfo by sending the transaction_entries_count. /// Extending ReplicaBlockInfo by sending the transaction_entries_count.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ReplicaBlockInfoV2<'a> { pub struct ReplicaBlockInfoV2<'a> {
pub parent_slot: u64,
pub parent_blockhash: &'a str,
pub slot: u64, pub slot: u64,
pub blockhash: &'a str, pub blockhash: &'a str,
pub rewards: &'a [Reward], pub rewards: &'a [Reward],

View File

@ -23,6 +23,8 @@ impl BlockMetadataNotifier for BlockMetadataNotifierImpl {
/// Notify the block metadata /// Notify the block metadata
fn notify_block_metadata( fn notify_block_metadata(
&self, &self,
parent_slot: u64,
parent_blockhash: &str,
slot: u64, slot: u64,
blockhash: &str, blockhash: &str,
rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>, rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>,
@ -39,6 +41,8 @@ impl BlockMetadataNotifier for BlockMetadataNotifierImpl {
for plugin in plugin_manager.plugins.iter_mut() { for plugin in plugin_manager.plugins.iter_mut() {
let mut measure = Measure::start("geyser-plugin-update-slot"); let mut measure = Measure::start("geyser-plugin-update-slot");
let block_info = Self::build_replica_block_info( let block_info = Self::build_replica_block_info(
parent_slot,
parent_blockhash,
slot, slot,
blockhash, blockhash,
&rewards, &rewards,
@ -91,6 +95,8 @@ impl BlockMetadataNotifierImpl {
} }
fn build_replica_block_info<'a>( fn build_replica_block_info<'a>(
parent_slot: u64,
parent_blockhash: &'a str,
slot: u64, slot: u64,
blockhash: &'a str, blockhash: &'a str,
rewards: &'a [Reward], rewards: &'a [Reward],
@ -99,6 +105,8 @@ impl BlockMetadataNotifierImpl {
executed_transaction_count: u64, executed_transaction_count: u64,
) -> ReplicaBlockInfoV2<'a> { ) -> ReplicaBlockInfoV2<'a> {
ReplicaBlockInfoV2 { ReplicaBlockInfoV2 {
parent_slot,
parent_blockhash,
slot, slot,
blockhash, blockhash,
rewards, rewards,

View File

@ -9,6 +9,8 @@ pub trait BlockMetadataNotifier {
/// Notify the block metadata /// Notify the block metadata
fn notify_block_metadata( fn notify_block_metadata(
&self, &self,
parent_slot: u64,
parent_blockhash: &str,
slot: u64, slot: u64,
blockhash: &str, blockhash: &str,
rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>, rewards: &RwLock<Vec<(Pubkey, RewardInfo)>>,