Rename AccountsPackage::root to AccountsPackage::slot

This commit is contained in:
Michael Vines 2021-01-04 13:22:58 -08:00
parent 9f70f7dc3e
commit 141e6706e6
4 changed files with 13 additions and 13 deletions

View File

@ -83,17 +83,17 @@ impl AccountsHashVerifier {
snapshot_interval_slots: u64, snapshot_interval_slots: u64,
) { ) {
if fault_injection_rate_slots != 0 if fault_injection_rate_slots != 0
&& accounts_package.root % fault_injection_rate_slots == 0 && accounts_package.slot % fault_injection_rate_slots == 0
{ {
// For testing, publish an invalid hash to gossip. // For testing, publish an invalid hash to gossip.
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use solana_sdk::hash::extend_and_hash; use solana_sdk::hash::extend_and_hash;
warn!("inserting fault at slot: {}", accounts_package.root); warn!("inserting fault at slot: {}", accounts_package.slot);
let rand = thread_rng().gen_range(0, 10); let rand = thread_rng().gen_range(0, 10);
let hash = extend_and_hash(&accounts_package.hash, &[rand]); let hash = extend_and_hash(&accounts_package.hash, &[rand]);
hashes.push((accounts_package.root, hash)); hashes.push((accounts_package.slot, hash));
} else { } else {
hashes.push((accounts_package.root, accounts_package.hash)); hashes.push((accounts_package.slot, accounts_package.hash));
} }
while hashes.len() > MAX_SNAPSHOT_HASHES { while hashes.len() > MAX_SNAPSHOT_HASHES {
@ -234,7 +234,7 @@ mod tests {
let accounts_package = AccountsPackage { let accounts_package = AccountsPackage {
hash: hash(&[i as u8]), hash: hash(&[i as u8]),
block_height: 100 + i as u64, block_height: 100 + i as u64,
root: 100 + i as u64, slot: 100 + i as u64,
slot_deltas: vec![], slot_deltas: vec![],
snapshot_links, snapshot_links,
tar_output_file: PathBuf::from("."), tar_output_file: PathBuf::from("."),

View File

@ -51,7 +51,7 @@ impl SnapshotPackagerService {
{ {
warn!("Failed to create snapshot archive: {}", err); warn!("Failed to create snapshot archive: {}", err);
} else { } else {
hashes.push((snapshot_package.root, snapshot_package.hash)); hashes.push((snapshot_package.slot, snapshot_package.hash));
while hashes.len() > MAX_SNAPSHOT_HASHES { while hashes.len() > MAX_SNAPSHOT_HASHES {
hashes.remove(0); hashes.remove(0);
} }

View File

@ -15,7 +15,7 @@ pub type AccountsPackageSendError = SendError<AccountsPackage>;
#[derive(Debug)] #[derive(Debug)]
pub struct AccountsPackage { pub struct AccountsPackage {
pub root: Slot, pub slot: Slot,
pub block_height: Slot, pub block_height: Slot,
pub slot_deltas: Vec<BankSlotDelta>, pub slot_deltas: Vec<BankSlotDelta>,
pub snapshot_links: TempDir, pub snapshot_links: TempDir,
@ -28,7 +28,7 @@ pub struct AccountsPackage {
impl AccountsPackage { impl AccountsPackage {
pub fn new( pub fn new(
root: Slot, slot: Slot,
block_height: u64, block_height: u64,
slot_deltas: Vec<BankSlotDelta>, slot_deltas: Vec<BankSlotDelta>,
snapshot_links: TempDir, snapshot_links: TempDir,
@ -39,7 +39,7 @@ impl AccountsPackage {
snapshot_version: SnapshotVersion, snapshot_version: SnapshotVersion,
) -> Self { ) -> Self {
Self { Self {
root, slot,
block_height, block_height,
slot_deltas, slot_deltas,
snapshot_links, snapshot_links,

View File

@ -229,11 +229,11 @@ pub fn remove_tmp_snapshot_archives(snapshot_path: &Path) {
pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<()> { pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<()> {
info!( info!(
"Generating snapshot archive for slot {}", "Generating snapshot archive for slot {}",
snapshot_package.root snapshot_package.slot
); );
serialize_status_cache( serialize_status_cache(
snapshot_package.root, snapshot_package.slot,
&snapshot_package.slot_deltas, &snapshot_package.slot_deltas,
&snapshot_package.snapshot_links.path().join(SNAPSHOT_STATUS_CACHE_FILE_NAME), &snapshot_package.snapshot_links.path().join(SNAPSHOT_STATUS_CACHE_FILE_NAME),
)?; )?;
@ -360,13 +360,13 @@ pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<()
info!( info!(
"Successfully created {:?}. slot: {}, elapsed ms: {}, size={}", "Successfully created {:?}. slot: {}, elapsed ms: {}, size={}",
snapshot_package.tar_output_file, snapshot_package.tar_output_file,
snapshot_package.root, snapshot_package.slot,
timer.as_ms(), timer.as_ms(),
metadata.len() metadata.len()
); );
datapoint_info!( datapoint_info!(
"snapshot-package", "snapshot-package",
("slot", snapshot_package.root, i64), ("slot", snapshot_package.slot, i64),
("duration_ms", timer.as_ms(), i64), ("duration_ms", timer.as_ms(), i64),
("size", metadata.len(), i64) ("size", metadata.len(), i64)
); );