Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update subscriptions api to use solana-labs#10147)
Browse files Browse the repository at this point in the history
Tyera Eulberg committed May 20, 2020

Verified

This commit was signed with the committer’s verified signature.
sagikazarmark Márk Sági-Kazár
1 parent 334032b commit f847262
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,
@@ -563,7 +562,6 @@ impl ClusterInfoVoteListener {
w_slot_tracker.total_stake,
&subscriptions,
epoch_stakes,
root,
slot,
);
w_slot_tracker.total_stake += current_stake;
@@ -576,7 +574,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()),
@@ -596,20 +594,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);
}
}
}

0 comments on commit f847262

Please sign in to comment.