Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast local operations #3415

Merged
merged 4 commits into from
Jan 16, 2023
Merged
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
13 changes: 12 additions & 1 deletion massa-protocol-worker/src/protocol_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,17 @@ impl ProtocolWorker {
self.checked_operations
.extend(operation_ids.iter().copied());

// Announce operations to active nodes not knowing about it.
let to_announce: Vec<OperationId> = operation_ids.iter().copied().collect();
// Broadcast operations to active sender(channel) subscribers.
if self.config.broadcast_enabled {
aoudiamoncef marked this conversation as resolved.
Show resolved Hide resolved
for op_id in to_announce.clone() {
if let Some(s_operation) = storage.read_operations().get(&op_id) {
let _ = self.operation_sender.send(s_operation.content.clone());
};
}
}

// Announce operations to active nodes not knowing about it.
self.note_operations_to_announce(&to_announce, op_timer)
.await;
}
Expand Down Expand Up @@ -939,11 +948,13 @@ impl ProtocolWorker {
}

if !new_operations.is_empty() {
// Broadcast operations to active sender(channel) subscribers.
if self.config.broadcast_enabled {
for op in new_operations.clone() {
let _ = self.operation_sender.send(op.1.content);
}
}

// Store operation, claim locally
let mut ops = self.storage.clone_without_refs();
ops.store_operations(new_operations.into_values().collect());
Expand Down