Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,6 @@ impl TransitionFrontierSyncAction {
if !store.dispatch(TransitionFrontierSyncAction::BlocksNextApplyInit) {
store.dispatch(TransitionFrontierSyncAction::BlocksSuccess);
}

// TODO this should be handled by a callback
store.dispatch(P2pNetworkPubsubAction::BroadcastValidatedMessage {
message_id: p2p::BroadcastMessageId::BlockHash { hash: hash.clone() },
});
}
TransitionFrontierSyncAction::BlocksSuccess => {}
// Bootstrap/Catchup is practically complete at this point.
Expand Down
16 changes: 12 additions & 4 deletions node/src/transition_frontier/transition_frontier_effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,18 @@ fn synced_effects<S: crate::Service>(
best_tip: best_tip.block.clone(),
});
}
// rebroadcast block if received from webrtc network, otherwise noop.
store.dispatch(P2pNetworkPubsubAction::WebRtcRebroadcast {
message: GossipNetMessageV2::NewState(best_tip.block().clone()),
});
// TODO this should be handled by a callback
// If this get dispatched, we received block from libp2p.
if !store.dispatch(P2pNetworkPubsubAction::BroadcastValidatedMessage {
message_id: p2p::BroadcastMessageId::BlockHash {
hash: best_tip.hash().clone(),
},
}) {
// Otherwise block was received from WebRTC so inject it in libp2p.
store.dispatch(P2pNetworkPubsubAction::WebRtcRebroadcast {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would happen if we dispatched this one unconditionally? is the conditional check what avoids the duplication of the message? (I ask because we can do this here because the transition frontier still doesn't use queued actions, but once that is implemented we will have to figure out something else here)

Copy link
Contributor Author

@binier binier Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the conditional check what avoids the duplication of the message?

but once that is implemented we will have to figure out something else here)

yes and yes

message: GossipNetMessageV2::NewState(best_tip.block().clone()),
});
}

let best_tip_hash = best_tip.merkle_root_hash().clone();
store.dispatch(ConsensusAction::Prune);
Expand Down
Loading