Skip to content

Commit 7d7a9f6

Browse files
v2.1: Startup only sets latest_full_snapshot_slot if generating snapshots (backport of #3633) (#3668)
Startup only sets latest_full_snapshot_slot if generating snapshots (#3633) (cherry picked from commit 4ea10c2) Co-authored-by: Brooks <[email protected]>
1 parent adeac02 commit 7d7a9f6

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

accounts-db/src/accounts_db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,7 @@ pub struct AccountsDb {
15481548
pub epoch_accounts_hash_manager: EpochAccountsHashManager,
15491549

15501550
/// The latest full snapshot slot dictates how to handle zero lamport accounts
1551+
/// Note, this is None if we're told to *not* take snapshots
15511552
latest_full_snapshot_slot: SeqLock<Option<Slot>>,
15521553

15531554
/// Flag to indicate if the experimental accounts lattice hash is enabled.

ledger/src/bank_forks_utils.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,20 @@ fn bank_forks_from_snapshot(
335335
// We must inform accounts-db of the latest full snapshot slot, which is used by the background
336336
// processes to handle zero lamport accounts. Since we've now successfully loaded the bank
337337
// from snapshots, this is a good time to do that update.
338-
bank.rc
339-
.accounts
340-
.accounts_db
341-
.set_latest_full_snapshot_slot(full_snapshot_archive_info.slot());
338+
// Note, this must only be set if we should generate snapshots.
339+
if snapshot_config.should_generate_snapshots() {
340+
bank.rc
341+
.accounts
342+
.accounts_db
343+
.set_latest_full_snapshot_slot(full_snapshot_archive_info.slot());
344+
} else {
345+
assert!(bank
346+
.rc
347+
.accounts
348+
.accounts_db
349+
.latest_full_snapshot_slot()
350+
.is_none());
351+
}
342352

343353
let full_snapshot_hash = FullSnapshotHash((
344354
full_snapshot_archive_info.slot(),

0 commit comments

Comments
 (0)