Use `VoteAccount::node_pubkey()` (#26207)
This commit is contained in:
parent
d5efbdb19b
commit
662818ef0d
|
@ -1995,11 +1995,7 @@ fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: boo
|
|||
if activated_stake == 0 {
|
||||
continue;
|
||||
}
|
||||
let vote_state_node_pubkey = vote_account
|
||||
.vote_state()
|
||||
.as_ref()
|
||||
.map(|vote_state| vote_state.node_pubkey)
|
||||
.unwrap_or_default();
|
||||
let vote_state_node_pubkey = vote_account.node_pubkey().unwrap_or_default();
|
||||
|
||||
if let Some(peer) = peers.get(&vote_state_node_pubkey) {
|
||||
if peer.shred_version == my_shred_version {
|
||||
|
|
|
@ -5051,8 +5051,9 @@ impl Bank {
|
|||
None
|
||||
} else {
|
||||
total_staked += *staked;
|
||||
let node_pubkey = account.vote_state().as_ref().ok()?.node_pubkey;
|
||||
Some((node_pubkey, *staked))
|
||||
account
|
||||
.node_pubkey()
|
||||
.map(|node_pubkey| (node_pubkey, *staked))
|
||||
}
|
||||
})
|
||||
.collect::<Vec<(Pubkey, u64)>>();
|
||||
|
|
|
@ -378,7 +378,7 @@ impl Stakes<StakeAccount> {
|
|||
|
||||
pub(crate) fn highest_staked_node(&self) -> Option<Pubkey> {
|
||||
let vote_account = self.vote_accounts.find_max_by_delegated_stake()?;
|
||||
Some(vote_account.vote_state().as_ref().ok()?.node_pubkey)
|
||||
vote_account.node_pubkey()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ impl VoteAccount {
|
|||
}
|
||||
|
||||
/// VoteState.node_pubkey of this vote-account.
|
||||
fn node_pubkey(&self) -> Option<Pubkey> {
|
||||
pub fn node_pubkey(&self) -> Option<Pubkey> {
|
||||
Some(self.vote_state().as_ref().ok()?.node_pubkey)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue