keygen: add dedicated solana-keygen grind
command (#6697)
* Remove dead code * Speed up vanity key grinding
This commit is contained in:
@ -768,36 +768,6 @@ impl Bank {
|
||||
}
|
||||
}
|
||||
|
||||
/// Looks through a list of tick heights and stakes, and finds the latest
|
||||
/// tick that has achieved confirmation
|
||||
pub fn get_confirmation_timestamp(
|
||||
&self,
|
||||
mut slots_and_stakes: Vec<(Slot, u64)>,
|
||||
supermajority_stake: u64,
|
||||
) -> Option<u64> {
|
||||
// Sort by slot height
|
||||
slots_and_stakes.sort_by(|a, b| b.0.cmp(&a.0));
|
||||
|
||||
let max_slot = self.slot();
|
||||
let min_slot = max_slot.saturating_sub(MAX_RECENT_BLOCKHASHES as u64);
|
||||
|
||||
let mut total_stake = 0;
|
||||
for (slot, stake) in slots_and_stakes.iter() {
|
||||
if *slot >= min_slot && *slot <= max_slot {
|
||||
total_stake += stake;
|
||||
if total_stake > supermajority_stake {
|
||||
return self
|
||||
.blockhash_queue
|
||||
.read()
|
||||
.unwrap()
|
||||
.hash_height_to_timestamp(*slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
/// Tell the bank which Entry IDs exist on the ledger. This function
|
||||
/// assumes subsequent calls correspond to later entries, and will boot
|
||||
/// the oldest ones once its internal cache is full. Once boot, the
|
||||
|
Reference in New Issue
Block a user