Skip to content

Commit

Permalink
remove test-only function from prod code, integrate into its only cal…
Browse files Browse the repository at this point in the history
…lsite
  • Loading branch information
alexpyattaev committed Jan 8, 2025
1 parent bacb073 commit e6e3e42
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 32 deletions.
20 changes: 0 additions & 20 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ use {
transaction::Transaction,
},
solana_streamer::{
packet,
quic::DEFAULT_QUIC_ENDPOINTS,
socket::SocketAddrSpace,
streamer::{PacketBatchReceiver, PacketBatchSender},
Expand Down Expand Up @@ -3035,25 +3034,6 @@ impl Node {
}
}

pub fn push_messages_to_peer(
messages: Vec<CrdsValue>,
self_id: Pubkey,
peer_gossip: SocketAddr,
socket_addr_space: &SocketAddrSpace,
) -> Result<(), GossipError> {
let reqs: Vec<_> = split_gossip_messages(PUSH_MESSAGE_MAX_PAYLOAD_SIZE, messages)
.map(move |payload| (peer_gossip, Protocol::PushMessage(self_id, payload)))
.collect();
let packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
&PacketBatchRecycler::default(),
"push_messages_to_peer",
&reqs,
);
let sock = bind_to_unspecified().unwrap();
packet::send_to(&packet_batch, &sock, socket_addr_space)?;
Ok(())
}

// Filters out values from nodes with different shred-version.
fn filter_on_shred_version(
mut msg: Protocol,
Expand Down
31 changes: 19 additions & 12 deletions local-cluster/src/cluster_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,18 +680,25 @@ pub fn submit_vote_to_cluster_gossip(
None,
);

cluster_info::push_messages_to_peer(
vec![CrdsValue::new(
CrdsData::Vote(
0,
crds_data::Vote::new(node_keypair.pubkey(), vote_tx, timestamp()).unwrap(),
),
node_keypair,
)],
node_keypair.pubkey(),
gossip_addr,
socket_addr_space,
)
let messages = vec![CrdsValue::new(
CrdsData::Vote(
0,
crds_data::Vote::new(node_keypair.pubkey(), vote_tx, timestamp()).unwrap(),
),
node_keypair,
)];
let self_id = node_keypair.pubkey();
let reqs: Vec<_> = split_gossip_messages(PUSH_MESSAGE_MAX_PAYLOAD_SIZE, messages)
.map(move |payload| (gossip_addr, Protocol::PushMessage(self_id, payload)))
.collect();
let packet_batch = PacketBatch::new_unpinned_with_recycler_data_and_dests(
&PacketBatchRecycler::default(),
"push_messages_to_peer",
&reqs,
);
let sock = bind_to_unspecified().unwrap();
packet::send_to(&packet_batch, &sock, socket_addr_space)?;
Ok(())
}

pub fn new_tpu_quic_client(
Expand Down

0 comments on commit e6e3e42

Please sign in to comment.