Add --warp-slot argument to |solana-ledger-tool create-snapshot| (#10474)

automerge
This commit is contained in:
mergify[bot]
2020-06-09 10:49:27 -07:00
committed by GitHub
parent f76dcc1f05
commit 053907f8a4
3 changed files with 51 additions and 5 deletions

View File

@@ -483,6 +483,20 @@ impl Bank {
new
}
/// Like `new_from_parent` but additionally:
/// * Doesn't assume that the parent is anywhere near `slot`, parent could be millions of slots
/// in the past
/// * Adjusts the new bank's tick height to avoid having to run PoH for millions of slots
/// * Freezes the new bank, assuming that the user will `Bank::new_from_parent` from this bank
pub fn warp_from_parent(parent: &Arc<Bank>, collector_id: &Pubkey, slot: Slot) -> Self {
let mut new = Bank::new_from_parent(parent, collector_id, slot);
new.update_epoch_stakes(new.epoch_schedule().get_epoch(slot));
new.tick_height
.store(new.max_tick_height(), Ordering::Relaxed);
new.freeze();
new
}
pub fn collector_id(&self) -> &Pubkey {
&self.collector_id
}