Remove redundant JsonRpcConfig::identity_pubkey field

This commit is contained in:
Michael Vines 2021-06-22 12:50:35 -07:00
parent ccf6b21bf8
commit 314102cb54
3 changed files with 10 additions and 11 deletions

View File

@ -460,9 +460,6 @@ impl TestValidator {
let tpu = node.info.tpu;
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();
if !authorized_voter_keypairs
@ -481,7 +478,7 @@ impl TestValidator {
node.info.rpc_pubsub.port(),
),
)),
rpc_config,
rpc_config: config.rpc_config.clone(),
accounts_hash_interval_slots: 100,
account_paths: vec![ledger_path.join("accounts")],
poh_verify: false, // Skip PoH verification of ledger on startup for speed

View File

@ -130,7 +130,6 @@ fn is_finalized(
pub struct JsonRpcConfig {
pub enable_rpc_transaction_history: bool,
pub enable_cpi_and_log_storage: bool,
pub identity_pubkey: Pubkey,
pub faucet_addr: Option<SocketAddr>,
pub health_check_slot_distance: u64,
pub enable_bigtable_ledger_storage: bool,
@ -2228,7 +2227,7 @@ pub mod rpc_minimal {
fn get_identity(&self, meta: Self::Metadata) -> Result<RpcIdentity> {
debug!("get_identity rpc request received");
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 _ = 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;
cluster_info.insert_info(ContactInfo::new_with_pubkey_socketaddr(
@ -4080,7 +4082,6 @@ pub mod tests {
let (meta, receiver) = JsonRpcRequestProcessor::new(
JsonRpcConfig {
enable_rpc_transaction_history: true,
identity_pubkey: *pubkey,
..JsonRpcConfig::default()
},
None,
@ -5815,14 +5816,16 @@ pub mod tests {
#[test]
fn test_rpc_get_identity() {
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 res = io.handle_request_sync(req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": {
"identity": bob_pubkey.to_string()
"identity": alice.pubkey().to_string()
},
"id": 1
});

View File

@ -2194,7 +2194,6 @@ pub fn main() {
enable_bigtable_ledger_storage: matches
.is_present("enable_rpc_bigtable_ledger_storage"),
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| {
solana_net_utils::parse_host_port(address).expect("failed to parse faucet address")
}),