Remove redundant JsonRpcConfig::identity_pubkey field
This commit is contained in:
		| @@ -460,9 +460,6 @@ impl TestValidator { | |||||||
|         let tpu = node.info.tpu; |         let tpu = node.info.tpu; | ||||||
|         let gossip = node.info.gossip; |         let gossip = node.info.gossip; | ||||||
|  |  | ||||||
|         let mut rpc_config = config.rpc_config.clone(); |  | ||||||
|         rpc_config.identity_pubkey = validator_identity.pubkey(); |  | ||||||
|  |  | ||||||
|         { |         { | ||||||
|             let mut authorized_voter_keypairs = config.authorized_voter_keypairs.write().unwrap(); |             let mut authorized_voter_keypairs = config.authorized_voter_keypairs.write().unwrap(); | ||||||
|             if !authorized_voter_keypairs |             if !authorized_voter_keypairs | ||||||
| @@ -481,7 +478,7 @@ impl TestValidator { | |||||||
|                     node.info.rpc_pubsub.port(), |                     node.info.rpc_pubsub.port(), | ||||||
|                 ), |                 ), | ||||||
|             )), |             )), | ||||||
|             rpc_config, |             rpc_config: config.rpc_config.clone(), | ||||||
|             accounts_hash_interval_slots: 100, |             accounts_hash_interval_slots: 100, | ||||||
|             account_paths: vec![ledger_path.join("accounts")], |             account_paths: vec![ledger_path.join("accounts")], | ||||||
|             poh_verify: false, // Skip PoH verification of ledger on startup for speed |             poh_verify: false, // Skip PoH verification of ledger on startup for speed | ||||||
|   | |||||||
| @@ -130,7 +130,6 @@ fn is_finalized( | |||||||
| pub struct JsonRpcConfig { | pub struct JsonRpcConfig { | ||||||
|     pub enable_rpc_transaction_history: bool, |     pub enable_rpc_transaction_history: bool, | ||||||
|     pub enable_cpi_and_log_storage: bool, |     pub enable_cpi_and_log_storage: bool, | ||||||
|     pub identity_pubkey: Pubkey, |  | ||||||
|     pub faucet_addr: Option<SocketAddr>, |     pub faucet_addr: Option<SocketAddr>, | ||||||
|     pub health_check_slot_distance: u64, |     pub health_check_slot_distance: u64, | ||||||
|     pub enable_bigtable_ledger_storage: bool, |     pub enable_bigtable_ledger_storage: bool, | ||||||
| @@ -2228,7 +2227,7 @@ pub mod rpc_minimal { | |||||||
|         fn get_identity(&self, meta: Self::Metadata) -> Result<RpcIdentity> { |         fn get_identity(&self, meta: Self::Metadata) -> Result<RpcIdentity> { | ||||||
|             debug!("get_identity rpc request received"); |             debug!("get_identity rpc request received"); | ||||||
|             Ok(RpcIdentity { |             Ok(RpcIdentity { | ||||||
|                 identity: meta.config.identity_pubkey.to_string(), |                 identity: meta.cluster_info.id().to_string(), | ||||||
|             }) |             }) | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -4055,7 +4054,10 @@ pub mod tests { | |||||||
|         let tx = system_transaction::transfer(&alice, pubkey, std::u64::MAX, blockhash); |         let tx = system_transaction::transfer(&alice, pubkey, std::u64::MAX, blockhash); | ||||||
|         let _ = bank.process_transaction(&tx); |         let _ = bank.process_transaction(&tx); | ||||||
|  |  | ||||||
|         let cluster_info = Arc::new(ClusterInfo::default()); |         let cluster_info = Arc::new(ClusterInfo::new_with_invalid_keypair(ContactInfo { | ||||||
|  |             id: alice.pubkey(), | ||||||
|  |             ..ContactInfo::default() | ||||||
|  |         })); | ||||||
|         let tpu_address = cluster_info.my_contact_info().tpu; |         let tpu_address = cluster_info.my_contact_info().tpu; | ||||||
|  |  | ||||||
|         cluster_info.insert_info(ContactInfo::new_with_pubkey_socketaddr( |         cluster_info.insert_info(ContactInfo::new_with_pubkey_socketaddr( | ||||||
| @@ -4080,7 +4082,6 @@ pub mod tests { | |||||||
|         let (meta, receiver) = JsonRpcRequestProcessor::new( |         let (meta, receiver) = JsonRpcRequestProcessor::new( | ||||||
|             JsonRpcConfig { |             JsonRpcConfig { | ||||||
|                 enable_rpc_transaction_history: true, |                 enable_rpc_transaction_history: true, | ||||||
|                 identity_pubkey: *pubkey, |  | ||||||
|                 ..JsonRpcConfig::default() |                 ..JsonRpcConfig::default() | ||||||
|             }, |             }, | ||||||
|             None, |             None, | ||||||
| @@ -5815,14 +5816,16 @@ pub mod tests { | |||||||
|     #[test] |     #[test] | ||||||
|     fn test_rpc_get_identity() { |     fn test_rpc_get_identity() { | ||||||
|         let bob_pubkey = solana_sdk::pubkey::new_rand(); |         let bob_pubkey = solana_sdk::pubkey::new_rand(); | ||||||
|         let RpcHandler { io, meta, .. } = start_rpc_handler_with_tx(&bob_pubkey); |         let RpcHandler { | ||||||
|  |             io, meta, alice, .. | ||||||
|  |         } = start_rpc_handler_with_tx(&bob_pubkey); | ||||||
|  |  | ||||||
|         let req = r#"{"jsonrpc":"2.0","id":1,"method":"getIdentity"}"#; |         let req = r#"{"jsonrpc":"2.0","id":1,"method":"getIdentity"}"#; | ||||||
|         let res = io.handle_request_sync(req, meta); |         let res = io.handle_request_sync(req, meta); | ||||||
|         let expected = json!({ |         let expected = json!({ | ||||||
|             "jsonrpc": "2.0", |             "jsonrpc": "2.0", | ||||||
|             "result": { |             "result": { | ||||||
|                 "identity": bob_pubkey.to_string() |                 "identity": alice.pubkey().to_string() | ||||||
|             }, |             }, | ||||||
|             "id": 1 |             "id": 1 | ||||||
|         }); |         }); | ||||||
|   | |||||||
| @@ -2194,7 +2194,6 @@ pub fn main() { | |||||||
|             enable_bigtable_ledger_storage: matches |             enable_bigtable_ledger_storage: matches | ||||||
|                 .is_present("enable_rpc_bigtable_ledger_storage"), |                 .is_present("enable_rpc_bigtable_ledger_storage"), | ||||||
|             enable_bigtable_ledger_upload: matches.is_present("enable_bigtable_ledger_upload"), |             enable_bigtable_ledger_upload: matches.is_present("enable_bigtable_ledger_upload"), | ||||||
|             identity_pubkey: identity_keypair.pubkey(), |  | ||||||
|             faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| { |             faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| { | ||||||
|                 solana_net_utils::parse_host_port(address).expect("failed to parse faucet address") |                 solana_net_utils::parse_host_port(address).expect("failed to parse faucet address") | ||||||
|             }), |             }), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user