Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions node/src/action_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub enum ActionKind {
BlockProducerWonSlotTransactionsGet,
BlockProducerWonSlotTransactionsSuccess,
BlockProducerWonSlotWait,
BlockProducerEffectfulBlockInjected,
BlockProducerEffectfulBlockProduced,
BlockProducerEffectfulBlockProveInit,
BlockProducerEffectfulBlockProveSuccess,
BlockProducerEffectfulBlockUnprovenBuild,
Expand Down Expand Up @@ -1019,7 +1019,7 @@ impl ActionKindGet for BlockProducerEffectfulAction {
Self::BlockUnprovenBuild => ActionKind::BlockProducerEffectfulBlockUnprovenBuild,
Self::BlockProveInit => ActionKind::BlockProducerEffectfulBlockProveInit,
Self::BlockProveSuccess => ActionKind::BlockProducerEffectfulBlockProveSuccess,
Self::BlockInjected { .. } => ActionKind::BlockProducerEffectfulBlockInjected,
Self::BlockProduced { .. } => ActionKind::BlockProducerEffectfulBlockProduced,
}
}
}
Expand Down
23 changes: 12 additions & 11 deletions node/src/block_producer/block_producer_reducer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,18 @@ impl BlockProducerEnabled {
bug_condition!("Invalid state for `BlockProducerAction::BlockProduced` expected: `BlockProducerCurrentState::BlockProveSuccess`, found: {:?}", current_state);
}

let dispatcher = state_context.into_dispatcher();
let (dispatcher, global_state) = state_context.into_dispatcher_and_state();

// Store the produced block in stats, used by heartbeats
let block = global_state
.block_producer
.as_ref()
.and_then(|bp| bp.current.produced_block())
.cloned();
if let Some(block) = block {
dispatcher.push(BlockProducerEffectfulAction::BlockProduced { block });
}

dispatcher.push(BlockProducerAction::BlockInject);
}
BlockProducerAction::BlockInject => {
Expand Down Expand Up @@ -360,16 +371,6 @@ impl BlockProducerEnabled {

let (dispatcher, global_state) = state_context.into_dispatcher_and_state();

// Store the produced block in stats, used by heartbeats
let block = global_state
.block_producer
.as_ref()
.and_then(|bp| bp.current.injected_block())
.cloned();
if let Some(block) = block {
dispatcher.push(BlockProducerEffectfulAction::BlockInjected { block });
}

#[cfg(feature = "p2p-libp2p")]
broadcast_injected_block(global_state, dispatcher);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum BlockProducerEffectfulAction {
BlockUnprovenBuild,
BlockProveInit,
BlockProveSuccess,
BlockInjected {
BlockProduced {
block: ArcBlockWithHash,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub fn block_producer_effects<S: crate::Service>(
}
store.dispatch(BlockProducerAction::WonSlotSearch);
}
BlockProducerEffectfulAction::BlockInjected { block } => {
BlockProducerEffectfulAction::BlockProduced { block } => {
if let Some(stats) = store.service.stats() {
stats.block_producer().last_produced_block = Some(block.clone());
}
Expand Down
Loading