Skip to content

Commit

Permalink
Update subscriptions api to use solana-labs#10147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyera Eulberg committed May 20, 2020
1 parent 02db2b9 commit 178e2ed
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{
cluster_info::{ClusterInfo, GOSSIP_SLEEP_MILLIS},
commitment::CacheSlotInfo,
consensus::VOTE_THRESHOLD_SIZE,
crds_value::CrdsValueLabel,
poh_recorder::PohRecorder,
Expand Down Expand Up @@ -555,7 +554,6 @@ impl ClusterInfoVoteListener {
w_slot_tracker.total_stake,
&subscriptions,
epoch_stakes,
root,
slot,
);
w_slot_tracker.total_stake += current_stake;
Expand All @@ -568,7 +566,7 @@ impl ClusterInfoVoteListener {
pubkey
})
.collect();
Self::notify_for_stake_change(total_stake, 0, &subscriptions, epoch_stakes, root, slot);
Self::notify_for_stake_change(total_stake, 0, &subscriptions, epoch_stakes, slot);
let new_slot_tracker = SlotVoteTracker {
voted: voted.clone(),
updates: Some(voted.into_iter().collect()),
Expand All @@ -588,20 +586,14 @@ impl ClusterInfoVoteListener {
previous_stake: u64,
subscriptions: &Arc<RpcSubscriptions>,
epoch_stakes: Option<&EpochStakes>,
root: Slot,
slot: Slot,
) {
if let Some(stakes) = epoch_stakes {
let supermajority_stake = (stakes.total_stake() as f64 * VOTE_THRESHOLD_SIZE) as u64;
if previous_stake < supermajority_stake
&& (previous_stake + current_stake) > supermajority_stake
{
subscriptions.notify_subscribers(CacheSlotInfo {
current_slot: slot,
node_root: root,
largest_confirmed_root: 0, // todo: ???
highest_confirmed_slot: 0,
});
subscriptions.notify_gossip_subscribers(slot);
}
}
}
Expand Down

0 comments on commit 178e2ed

Please sign in to comment.