Rename AccountsPackage::root to AccountsPackage::slot
This commit is contained in:
parent
9f70f7dc3e
commit
141e6706e6
|
@ -83,17 +83,17 @@ impl AccountsHashVerifier {
|
|||
snapshot_interval_slots: u64,
|
||||
) {
|
||||
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.
|
||||
use rand::{thread_rng, Rng};
|
||||
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 hash = extend_and_hash(&accounts_package.hash, &[rand]);
|
||||
hashes.push((accounts_package.root, hash));
|
||||
hashes.push((accounts_package.slot, hash));
|
||||
} else {
|
||||
hashes.push((accounts_package.root, accounts_package.hash));
|
||||
hashes.push((accounts_package.slot, accounts_package.hash));
|
||||
}
|
||||
|
||||
while hashes.len() > MAX_SNAPSHOT_HASHES {
|
||||
|
@ -234,7 +234,7 @@ mod tests {
|
|||
let accounts_package = AccountsPackage {
|
||||
hash: hash(&[i as u8]),
|
||||
block_height: 100 + i as u64,
|
||||
root: 100 + i as u64,
|
||||
slot: 100 + i as u64,
|
||||
slot_deltas: vec![],
|
||||
snapshot_links,
|
||||
tar_output_file: PathBuf::from("."),
|
||||
|
|
|
@ -51,7 +51,7 @@ impl SnapshotPackagerService {
|
|||
{
|
||||
warn!("Failed to create snapshot archive: {}", err);
|
||||
} else {
|
||||
hashes.push((snapshot_package.root, snapshot_package.hash));
|
||||
hashes.push((snapshot_package.slot, snapshot_package.hash));
|
||||
while hashes.len() > MAX_SNAPSHOT_HASHES {
|
||||
hashes.remove(0);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ pub type AccountsPackageSendError = SendError<AccountsPackage>;
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct AccountsPackage {
|
||||
pub root: Slot,
|
||||
pub slot: Slot,
|
||||
pub block_height: Slot,
|
||||
pub slot_deltas: Vec<BankSlotDelta>,
|
||||
pub snapshot_links: TempDir,
|
||||
|
@ -28,7 +28,7 @@ pub struct AccountsPackage {
|
|||
|
||||
impl AccountsPackage {
|
||||
pub fn new(
|
||||
root: Slot,
|
||||
slot: Slot,
|
||||
block_height: u64,
|
||||
slot_deltas: Vec<BankSlotDelta>,
|
||||
snapshot_links: TempDir,
|
||||
|
@ -39,7 +39,7 @@ impl AccountsPackage {
|
|||
snapshot_version: SnapshotVersion,
|
||||
) -> Self {
|
||||
Self {
|
||||
root,
|
||||
slot,
|
||||
block_height,
|
||||
slot_deltas,
|
||||
snapshot_links,
|
||||
|
|
|
@ -229,11 +229,11 @@ pub fn remove_tmp_snapshot_archives(snapshot_path: &Path) {
|
|||
pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<()> {
|
||||
info!(
|
||||
"Generating snapshot archive for slot {}",
|
||||
snapshot_package.root
|
||||
snapshot_package.slot
|
||||
);
|
||||
|
||||
serialize_status_cache(
|
||||
snapshot_package.root,
|
||||
snapshot_package.slot,
|
||||
&snapshot_package.slot_deltas,
|
||||
&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!(
|
||||
"Successfully created {:?}. slot: {}, elapsed ms: {}, size={}",
|
||||
snapshot_package.tar_output_file,
|
||||
snapshot_package.root,
|
||||
snapshot_package.slot,
|
||||
timer.as_ms(),
|
||||
metadata.len()
|
||||
);
|
||||
datapoint_info!(
|
||||
"snapshot-package",
|
||||
("slot", snapshot_package.root, i64),
|
||||
("slot", snapshot_package.slot, i64),
|
||||
("duration_ms", timer.as_ms(), i64),
|
||||
("size", metadata.len(), i64)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue