Remove id ref
This commit is contained in:
parent
0426c2d28e
commit
bf157506e8
|
@ -2725,9 +2725,9 @@ impl ClusterInfo {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn gossip_contact_info(id: &Pubkey, gossip: SocketAddr, shred_version: u16) -> ContactInfo {
|
||||
pub fn gossip_contact_info(id: Pubkey, gossip: SocketAddr, shred_version: u16) -> ContactInfo {
|
||||
ContactInfo {
|
||||
id: *id,
|
||||
id,
|
||||
gossip,
|
||||
wallclock: timestamp(),
|
||||
shred_version,
|
||||
|
@ -2737,7 +2737,7 @@ impl ClusterInfo {
|
|||
|
||||
/// An alternative to Spy Node that has a valid gossip address and fully participate in Gossip.
|
||||
pub fn gossip_node(
|
||||
id: &Pubkey,
|
||||
id: Pubkey,
|
||||
gossip_addr: &SocketAddr,
|
||||
shred_version: u16,
|
||||
) -> (ContactInfo, UdpSocket, Option<TcpListener>) {
|
||||
|
@ -2752,7 +2752,7 @@ impl ClusterInfo {
|
|||
|
||||
/// A Node with dummy ports to spy on gossip via pull requests
|
||||
pub fn spy_node(
|
||||
id: &Pubkey,
|
||||
id: Pubkey,
|
||||
shred_version: u16,
|
||||
) -> (ContactInfo, UdpSocket, Option<TcpListener>) {
|
||||
let bind_ip_addr = IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0));
|
||||
|
@ -3141,10 +3141,10 @@ mod tests {
|
|||
#[test]
|
||||
fn test_gossip_node() {
|
||||
//check that a gossip nodes always show up as spies
|
||||
let (node, _, _) = ClusterInfo::spy_node(&solana_sdk::pubkey::new_rand(), 0);
|
||||
let (node, _, _) = ClusterInfo::spy_node(solana_sdk::pubkey::new_rand(), 0);
|
||||
assert!(ClusterInfo::is_spy_node(&node));
|
||||
let (node, _, _) = ClusterInfo::gossip_node(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
&"1.1.1.1:1111".parse().unwrap(),
|
||||
0,
|
||||
);
|
||||
|
@ -3424,7 +3424,7 @@ mod tests {
|
|||
let thread_pool = ThreadPoolBuilder::new().build().unwrap();
|
||||
//check that gossip doesn't try to push to invalid addresses
|
||||
let node = Node::new_localhost();
|
||||
let (spy, _, _) = ClusterInfo::spy_node(&solana_sdk::pubkey::new_rand(), 0);
|
||||
let (spy, _, _) = ClusterInfo::spy_node(solana_sdk::pubkey::new_rand(), 0);
|
||||
let cluster_info = Arc::new(ClusterInfo::new_with_invalid_keypair(node.info));
|
||||
cluster_info.insert_info(spy);
|
||||
cluster_info
|
||||
|
|
|
@ -303,9 +303,9 @@ fn make_gossip_node(
|
|||
should_check_duplicate_instance: bool,
|
||||
) -> (GossipService, Option<TcpListener>, Arc<ClusterInfo>) {
|
||||
let (node, gossip_socket, ip_echo) = if let Some(gossip_addr) = gossip_addr {
|
||||
ClusterInfo::gossip_node(&keypair.pubkey(), gossip_addr, shred_version)
|
||||
ClusterInfo::gossip_node(keypair.pubkey(), gossip_addr, shred_version)
|
||||
} else {
|
||||
ClusterInfo::spy_node(&keypair.pubkey(), shred_version)
|
||||
ClusterInfo::spy_node(keypair.pubkey(), shred_version)
|
||||
};
|
||||
let cluster_info = ClusterInfo::new(node, keypair);
|
||||
if let Some(entrypoint) = entrypoint {
|
||||
|
|
|
@ -360,7 +360,7 @@ fn start_gossip_node(
|
|||
) -> (Arc<ClusterInfo>, Arc<AtomicBool>, GossipService) {
|
||||
let mut cluster_info = ClusterInfo::new(
|
||||
ClusterInfo::gossip_contact_info(
|
||||
&identity_keypair.pubkey(),
|
||||
identity_keypair.pubkey(),
|
||||
*gossip_addr,
|
||||
expected_shred_version.unwrap_or(0),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue