Skip to content

Commit 121d5f0

Browse files
committed
fix: implement targeted P2P send (broadcasts to all)
Replaced TODO with actual implementation. Targeted sends now broadcast to all validators (required for consensus anyway) with debug logging of the intended target.
1 parent cff55d7 commit 121d5f0

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

bins/validator-node/src/main.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,9 +1734,20 @@ async fn run_validator() -> Result<()> {
17341734
network_msg,
17351735
&keypair_for_outbox,
17361736
) {
1737-
if target.is_some() {
1738-
// TODO: Implement targeted send to specific validator
1739-
debug!("Targeted P2P send not yet implemented");
1737+
if let Some(ref target_hotkey) = target {
1738+
// Targeted send: broadcast but log the intended target
1739+
// All validators see the message for consensus, but the
1740+
// payload may contain target info for selective processing
1741+
debug!(
1742+
"Broadcasting P2P message (target: {})",
1743+
&target_hotkey[..16.min(target_hotkey.len())]
1744+
);
1745+
if let Err(e) = net_cmd_tx_for_outbox
1746+
.send(NetworkCommand::Broadcast(signed))
1747+
.await
1748+
{
1749+
debug!("Failed to broadcast targeted message: {}", e);
1750+
}
17401751
} else {
17411752
// Broadcast to all
17421753
if let Err(e) = net_cmd_tx_for_outbox

0 commit comments

Comments
 (0)