Skip to content

Commit

Permalink
[Consensus Observer] Add hash index to pending blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLind committed Feb 6, 2025
1 parent ac7a415 commit d45756e
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 42 deletions.
2 changes: 2 additions & 0 deletions consensus/src/consensus_observer/common/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ pub const CREATED_SUBSCRIPTION_LABEL: &str = "created_subscription";
pub const ORDERED_BLOCK_ENTRIES_LABEL: &str = "ordered_block_entries";
pub const ORDERED_BLOCK_LABEL: &str = "ordered_block";
pub const ORDERED_BLOCK_WITH_WINDOW_LABEL: &str = "ordered_block_with_window";
pub const PENDING_BLOCK_ENTRIES_BY_HASH_LABEL: &str = "pending_block_by_hash_entries";
pub const PENDING_BLOCK_ENTRIES_LABEL: &str = "pending_block_entries";
pub const PENDING_BLOCKS_BY_HASH_LABEL: &str = "pending_blocks_by_hash";
pub const PENDING_BLOCKS_LABEL: &str = "pending_blocks";
pub const STORED_PAYLOADS_LABEL: &str = "stored_payloads";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ impl ConsensusObserver {

// Create a new pending block with metadata
let observed_ordered_block = ObservedOrderedBlock::new(ordered_block);
let pending_block_with_metadata = PendingBlockWithMetadata::new(
let pending_block_with_metadata = PendingBlockWithMetadata::new_with_arc(
peer_network_id,
message_received_time,
observed_ordered_block,
Expand All @@ -756,11 +756,11 @@ impl ConsensusObserver {
/// has been sanity checked and that all payloads exist.
async fn process_ordered_block(
&mut self,
pending_block_with_metadata: PendingBlockWithMetadata,
pending_block_with_metadata: Arc<PendingBlockWithMetadata>,
) {
// Unpack the pending block
let (peer_network_id, message_received_time, observed_ordered_block) =
pending_block_with_metadata.into_parts();
pending_block_with_metadata.unpack();
let ordered_block = observed_ordered_block.ordered_block().clone();

// Verify the ordered block proof
Expand Down
Loading

0 comments on commit d45756e

Please sign in to comment.