Store and persists full stack of tower votes in gossip (#6695)
* vote array wip wip wip update gossip index should match tower index tests build clippy test index after expired vote test bank specific last vote sync time * verify * we are likely to see many more warnings about old votes now
This commit is contained in:
committed by
GitHub
parent
57983980a7
commit
f54cfcdb8f
@ -262,6 +262,10 @@ pub struct Bank {
|
||||
/// (used to adjust cluster features over time)
|
||||
#[serde(skip)]
|
||||
entered_epoch_callback: Arc<RwLock<Option<EnteredEpochCallback>>>,
|
||||
|
||||
/// Last time when the cluster info vote listener has synced with this bank
|
||||
#[serde(skip)]
|
||||
pub last_vote_sync: AtomicU64,
|
||||
}
|
||||
|
||||
impl Default for BlockhashQueue {
|
||||
@ -352,6 +356,7 @@ impl Bank {
|
||||
signature_count: AtomicU64::new(0),
|
||||
message_processor: MessageProcessor::default(),
|
||||
entered_epoch_callback: parent.entered_epoch_callback.clone(),
|
||||
last_vote_sync: AtomicU64::new(parent.last_vote_sync.load(Ordering::Relaxed)),
|
||||
};
|
||||
|
||||
datapoint_debug!(
|
||||
@ -3347,7 +3352,6 @@ mod tests {
|
||||
// Non-native loader accounts can not be used for instruction processing
|
||||
bank.add_instruction_processor(mint_keypair.pubkey(), mock_ix_processor);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_recent_blockhashes_sysvar() {
|
||||
let (genesis_block, _mint_keypair) = create_genesis_block(500);
|
||||
@ -3365,4 +3369,16 @@ mod tests {
|
||||
bank = Arc::new(new_from_parent(&bank));
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_bank_inherit_last_vote_sync() {
|
||||
let (genesis_block, _) = create_genesis_block(500);
|
||||
let bank0 = Arc::new(Bank::new(&genesis_block));
|
||||
let last_ts = bank0.last_vote_sync.load(Ordering::Relaxed);
|
||||
assert_eq!(last_ts, 0);
|
||||
bank0.last_vote_sync.store(1, Ordering::Relaxed);
|
||||
let bank1 =
|
||||
Bank::new_from_parent(&bank0, &Pubkey::default(), bank0.get_slots_in_epoch(0) - 1);
|
||||
let last_ts = bank1.last_vote_sync.load(Ordering::Relaxed);
|
||||
assert_eq!(last_ts, 1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user