Maintenance : simplify a few patterns, remove unneeded dependencies (#8137)
* Simplify a few pattern matches * Removing unneeded dependencies, upgrading internal version #s net-shaper: Removing log, semver, serde_derive bench-tps: Removing serde, serde_derive banking-bench: Removing solana ledger-tool: Removing bincode, serde, serde_derive librapay: Removing solana, language_e2e_tests log-analyzer: Removing log, semver, serde_derive exchange: Removing solana core: Removing crc, memmap, symlink, untrusted perf: Removing serde_derive genesis: Removing hex, serde_derive sdk-c: Removing sha2 sys-tuner: Removing semver bench-exchange: Removing bincode, bs58, env_logger, serde, serde_derive, untrusted, ws btc_spv_bin: Removing serde_json btc_spv: Removing chrono bpf_loader: Removing serde ledger: Removing dlopen, dlopen_derive, serde_derive move_loader: Removing byteorder, libc, language_e2e_tests ownable: Removing serde, serde_derive client: Removing rand archiver-utils: Removing rand_chacha validator: Removing serde_json, tempfile param_passing_dep: Removing solana failure: Removing log vest: Removing log vote-signer: Removing bs58, serde local-cluster: Removing symlink keygen: Removing rpassword install: Removing bs58, log upload-perf: Removing log runtime: Removing serde_json stake: Removing rand * Add modified Cargo.lock * fixup! Simplify a few pattern matches * fixup! Simplify a few pattern matches
This commit is contained in:
committed by
GitHub
parent
59ba1df910
commit
f016c9a669
@ -660,10 +660,7 @@ impl BankingStage {
|
||||
transactions
|
||||
.into_iter()
|
||||
.zip(indexes)
|
||||
.filter_map(|(tx, index)| match tx {
|
||||
None => None,
|
||||
Some(tx) => Some((tx, index)),
|
||||
})
|
||||
.filter_map(|(tx, index)| tx.map(|tx| (tx, index)))
|
||||
.unzip()
|
||||
}
|
||||
|
||||
|
@ -402,8 +402,7 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.rpc))
|
||||
.filter(|x| x.id != me.id && ContactInfo::is_valid_address(&x.rpc))
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -429,10 +428,8 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| x.id != me)
|
||||
/* shred_version not considered for gossip peers (ie, spy nodes do not set
|
||||
shred_version) */
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.gossip))
|
||||
// shred_version not considered for gossip peers (ie, spy nodes do not set shred_version)
|
||||
.filter(|x| x.id != me && ContactInfo::is_valid_address(&x.gossip))
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -445,9 +442,11 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.tvu))
|
||||
.filter(|x| !ClusterInfo::is_archiver(x))
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| {
|
||||
ContactInfo::is_valid_address(&x.tvu)
|
||||
&& !ClusterInfo::is_archiver(x)
|
||||
&& x.id != me.id
|
||||
})
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -460,10 +459,12 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.tvu))
|
||||
.filter(|x| !ClusterInfo::is_archiver(x))
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| x.shred_version == me.shred_version)
|
||||
.filter(|x| {
|
||||
ContactInfo::is_valid_address(&x.tvu)
|
||||
&& !ClusterInfo::is_archiver(x)
|
||||
&& x.id != me.id
|
||||
&& x.shred_version == me.shred_version
|
||||
})
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -476,8 +477,7 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.storage_addr))
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.storage_addr) && x.id != me.id)
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -490,9 +490,11 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.storage_addr))
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| x.shred_version == me.shred_version)
|
||||
.filter(|x| {
|
||||
ContactInfo::is_valid_address(&x.storage_addr)
|
||||
&& x.id != me.id
|
||||
&& x.shred_version == me.shred_version
|
||||
})
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -505,10 +507,12 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| x.shred_version == me.shred_version)
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.tvu))
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.tvu_forwards))
|
||||
.filter(|x| {
|
||||
x.id != me.id
|
||||
&& x.shred_version == me.shred_version
|
||||
&& ContactInfo::is_valid_address(&x.tvu)
|
||||
&& ContactInfo::is_valid_address(&x.tvu_forwards)
|
||||
})
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -518,13 +522,15 @@ impl ClusterInfo {
|
||||
let me = self.my_data();
|
||||
ClusterInfo::tvu_peers(self)
|
||||
.into_iter()
|
||||
.filter(|x| x.id != me.id)
|
||||
.filter(|x| x.shred_version == me.shred_version)
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.gossip))
|
||||
.filter(|x| {
|
||||
self.get_epoch_state_for_node(&x.id, None)
|
||||
.map(|(epoch_slots, _)| epoch_slots.lowest <= slot)
|
||||
.unwrap_or_else(|| /* fallback to legacy behavior */ true)
|
||||
x.id != me.id
|
||||
&& x.shred_version == me.shred_version
|
||||
&& ContactInfo::is_valid_address(&x.gossip)
|
||||
&& {
|
||||
self.get_epoch_state_for_node(&x.id, None)
|
||||
.map(|(epoch_slots, _)| epoch_slots.lowest <= slot)
|
||||
.unwrap_or_else(|| /* fallback to legacy behavior */ true)
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@ -621,8 +627,7 @@ impl ClusterInfo {
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.contact_info())
|
||||
.filter(|x| x.id != me)
|
||||
.filter(|x| ContactInfo::is_valid_address(&x.tpu))
|
||||
.filter(|x| x.id != me && ContactInfo::is_valid_address(&x.tpu))
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
@ -984,12 +989,11 @@ impl ClusterInfo {
|
||||
.and_then(CrdsValue::contact_info)
|
||||
.map(|p| (p.gossip, messages))
|
||||
})
|
||||
.map(|(peer, msgs)| {
|
||||
.flat_map(|(peer, msgs)| {
|
||||
Self::split_gossip_messages(msgs)
|
||||
.into_iter()
|
||||
.map(move |payload| (peer, Protocol::PushMessage(self_id, payload)))
|
||||
})
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,7 @@ impl JsonRpcRequestProcessor {
|
||||
commitment: Option<CommitmentConfig>,
|
||||
) -> RpcResponse<Option<RpcAccount>> {
|
||||
let bank = &*self.bank(commitment);
|
||||
match pubkey {
|
||||
Ok(key) => new_response(bank, bank.get_account(&key).map(RpcAccount::encode)),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
pubkey.and_then(|key| new_response(bank, bank.get_account(&key).map(RpcAccount::encode)))
|
||||
}
|
||||
|
||||
pub fn get_minimum_balance_for_rent_exemption(
|
||||
@ -148,10 +145,7 @@ impl JsonRpcRequestProcessor {
|
||||
commitment: Option<CommitmentConfig>,
|
||||
) -> RpcResponse<u64> {
|
||||
let bank = &*self.bank(commitment);
|
||||
match pubkey {
|
||||
Ok(key) => new_response(bank, bank.get_balance(&key)),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
pubkey.and_then(|key| new_response(bank, bank.get_balance(&key)))
|
||||
}
|
||||
|
||||
fn get_recent_blockhash(
|
||||
|
Reference in New Issue
Block a user