From bc1227e17d09558920cc692123653eca52c56dc0 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Thu, 28 Jul 2022 18:12:00 -0500 Subject: [PATCH] serialize incremental_snapshot_hash --- runtime/src/bank.rs | 10 ++++++++++ runtime/src/serde_snapshot/newer.rs | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index c38eea8ce70ee2..66eec929ac4303 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -234,6 +234,15 @@ impl RentDebit { } } +#[derive(Serialize, Deserialize, AbiExample, Clone, Debug, Default, PartialEq, Eq)] +pub struct BankIncrementalSnapshotPersistence { + full_hash: Hash, + full_slot: Slot, + full_capitalization: u64, + incremental_hash: Hash, + inremental_capitalization: u64, +} + #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct RentDebits(HashMap); impl RentDebits { @@ -974,6 +983,7 @@ pub struct BankFieldsToDeserialize { pub(crate) epoch_stakes: HashMap, pub(crate) is_delta: bool, pub(crate) accounts_data_len: u64, + pub(crate) incremental_snapshot_hash: Option, } // Bank's common fields shared by all supported snapshot versions for serialization. diff --git a/runtime/src/serde_snapshot/newer.rs b/runtime/src/serde_snapshot/newer.rs index 3dd73803cf3010..7af0e31feef500 100644 --- a/runtime/src/serde_snapshot/newer.rs +++ b/runtime/src/serde_snapshot/newer.rs @@ -96,6 +96,7 @@ impl From for BankFieldsToDeserialize { stakes: dvb.stakes, epoch_stakes: dvb.epoch_stakes, is_delta: dvb.is_delta, + incremental_snapshot_hash: None, } } } @@ -314,6 +315,9 @@ impl<'a> TypeContext<'a> for Context { bank_fields.fee_rate_governor = bank_fields .fee_rate_governor .clone_with_lamports_per_signature(lamports_per_signature); + let incremental_snapshot_hash = + ignore_eof_error(deserialize_from(stream))?; + bank_fields.incremental_snapshot_hash = incremental_snapshot_hash; Ok((bank_fields, accounts_db_fields)) }