Cleanup leader_addr, it's really entrypoint_addr

This commit is contained in:
Michael Vines
2019-01-21 11:14:27 -08:00
parent cb23070dfe
commit 6e8b69fc88

View File

@ -114,7 +114,7 @@ impl Fullnode {
ledger_path: &str, ledger_path: &str,
keypair: Arc<Keypair>, keypair: Arc<Keypair>,
vote_signer: Arc<VoteSignerProxy>, vote_signer: Arc<VoteSignerProxy>,
leader_addr: Option<SocketAddr>, entrypoint_addr: Option<SocketAddr>,
sigverify_disabled: bool, sigverify_disabled: bool,
leader_scheduler: LeaderScheduler, leader_scheduler: LeaderScheduler,
rpc_port: Option<u16>, rpc_port: Option<u16>,
@ -128,7 +128,7 @@ impl Fullnode {
ledger_path, ledger_path,
keypair, keypair,
vote_signer, vote_signer,
leader_addr, entrypoint_addr,
sigverify_disabled, sigverify_disabled,
leader_scheduler, leader_scheduler,
rpc_port, rpc_port,
@ -141,7 +141,7 @@ impl Fullnode {
ledger_path: &str, ledger_path: &str,
keypair: Arc<Keypair>, keypair: Arc<Keypair>,
vote_signer: Arc<VoteSignerProxy>, vote_signer: Arc<VoteSignerProxy>,
leader_addr: Option<SocketAddr>, entrypoint_addr: Option<SocketAddr>,
sigverify_disabled: bool, sigverify_disabled: bool,
leader_scheduler: LeaderScheduler, leader_scheduler: LeaderScheduler,
rpc_port: Option<u16>, rpc_port: Option<u16>,
@ -166,9 +166,9 @@ impl Fullnode {
rpc_addr.set_port(port); rpc_addr.set_port(port);
} }
info!("node rpc address: {}", rpc_addr); info!("node rpc address: {}", rpc_addr);
info!("node leader_addr: {:?}", leader_addr); info!("node entrypoint_addr: {:?}", entrypoint_addr);
let leader_info = leader_addr.map(|i| NodeInfo::new_entry_point(&i)); let entrypoint_info = entrypoint_addr.map(|i| NodeInfo::new_entry_point(&i));
Self::new_with_bank( Self::new_with_bank(
keypair, keypair,
vote_signer, vote_signer,
@ -177,7 +177,7 @@ impl Fullnode {
entry_height, entry_height,
&last_entry_id, &last_entry_id,
node, node,
leader_info.as_ref(), entrypoint_info.as_ref(),
ledger_path, ledger_path,
sigverify_disabled, sigverify_disabled,
rpc_port, rpc_port,
@ -195,7 +195,7 @@ impl Fullnode {
entry_height: u64, entry_height: u64,
last_entry_id: &Hash, last_entry_id: &Hash,
mut node: Node, mut node: Node,
bootstrap_leader_info_option: Option<&NodeInfo>, entrypoint_info_option: Option<&NodeInfo>,
ledger_path: &str, ledger_path: &str,
sigverify_disabled: bool, sigverify_disabled: bool,
rpc_port: Option<u16>, rpc_port: Option<u16>,
@ -224,15 +224,19 @@ impl Fullnode {
keypair.clone(), keypair.clone(),
))); )));
// Assume there's a drone running on the bootstrap leader // TODO: The RPC service assumes that there is a drone running on the cluster
let mut drone_addr = match bootstrap_leader_info_option { // entrypoint, which is a bad assumption.
Some(bootstrap_leader_info) => bootstrap_leader_info.rpc, // See https://github.com/solana-labs/solana/issues/1830 for the removal of drone
// from the RPC API
let drone_addr = {
let mut entrypoint_drone_addr = match entrypoint_info_option {
Some(entrypoint_info_info) => entrypoint_info_info.rpc,
None => rpc_addr, None => rpc_addr,
}; };
drone_addr.set_port(solana_drone::drone::DRONE_PORT); entrypoint_drone_addr.set_port(solana_drone::drone::DRONE_PORT);
entrypoint_drone_addr
};
// TODO: The RPC service assumes that there is a drone running on the leader
// See https://github.com/solana-labs/solana/issues/1830
let rpc_service = JsonRpcService::new( let rpc_service = JsonRpcService::new(
&bank, &bank,
&cluster_info, &cluster_info,
@ -255,13 +259,13 @@ impl Fullnode {
exit.clone(), exit.clone(),
); );
// Insert the bootstrap leader info, should only be None if this node // Insert the entrypoint info, should only be None if this node
// is the bootstrap leader // is the bootstrap leader
if let Some(bootstrap_leader_info) = bootstrap_leader_info_option { if let Some(entrypoint_info) = entrypoint_info_option {
cluster_info cluster_info
.write() .write()
.unwrap() .unwrap()
.insert_info(bootstrap_leader_info.clone()); .insert_info(entrypoint_info.clone());
} }
// Get the scheduled leader // Get the scheduled leader