@@ -6190,6 +6190,41 @@ impl Bank {
6190
6190
base : Option < ( Slot , /*capitalization*/ u64 ) > ,
6191
6191
duplicates_lt_hash : Option < Box < DuplicatesLtHash > > ,
6192
6192
) -> bool {
6193
+ // If we verify the accounts using the lattice-based hash *and* with storages (as opposed
6194
+ // to the index), then we rely on the DuplicatesLtHash as given by generate_index(). Since
6195
+ // the duplicates are based on a specific set of storages, we must use the exact same
6196
+ // storages to do the lattice-based accounts verification. This means we must wait to
6197
+ // clean/shrink until *after* we've gotten Arcs to the storages (this prevents their
6198
+ // untimely removal). Simply, we call `verify_accounts_hash()` before we call `clean` or
6199
+ // `shrink`.
6200
+ let ( verified_accounts, verify_accounts_time_us) = measure_us ! ( {
6201
+ let should_verify_accounts = !self . rc. accounts. accounts_db. skip_initial_hash_calc;
6202
+ if should_verify_accounts {
6203
+ info!( "Verifying accounts..." ) ;
6204
+ let verified = self . verify_accounts_hash(
6205
+ base,
6206
+ VerifyAccountsHashConfig {
6207
+ test_hash_calculation,
6208
+ ignore_mismatch: false ,
6209
+ require_rooted_bank: false ,
6210
+ run_in_background: true ,
6211
+ store_hash_raw_data_for_debug: false ,
6212
+ } ,
6213
+ duplicates_lt_hash,
6214
+ ) ;
6215
+ info!( "Verifying accounts... In background." ) ;
6216
+ verified
6217
+ } else {
6218
+ info!( "Verifying accounts... Skipped." ) ;
6219
+ self . rc
6220
+ . accounts
6221
+ . accounts_db
6222
+ . verify_accounts_hash_in_bg
6223
+ . verification_complete( ) ;
6224
+ true
6225
+ }
6226
+ } ) ;
6227
+
6193
6228
let ( _, clean_time_us) = measure_us ! ( {
6194
6229
let should_clean = force_clean || ( !skip_shrink && self . slot( ) > 0 ) ;
6195
6230
if should_clean {
@@ -6225,34 +6260,6 @@ impl Bank {
6225
6260
}
6226
6261
} ) ;
6227
6262
6228
- let ( verified_accounts, verify_accounts_time_us) = measure_us ! ( {
6229
- let should_verify_accounts = !self . rc. accounts. accounts_db. skip_initial_hash_calc;
6230
- if should_verify_accounts {
6231
- info!( "Verifying accounts..." ) ;
6232
- let verified = self . verify_accounts_hash(
6233
- base,
6234
- VerifyAccountsHashConfig {
6235
- test_hash_calculation,
6236
- ignore_mismatch: false ,
6237
- require_rooted_bank: false ,
6238
- run_in_background: true ,
6239
- store_hash_raw_data_for_debug: false ,
6240
- } ,
6241
- duplicates_lt_hash,
6242
- ) ;
6243
- info!( "Verifying accounts... In background." ) ;
6244
- verified
6245
- } else {
6246
- info!( "Verifying accounts... Skipped." ) ;
6247
- self . rc
6248
- . accounts
6249
- . accounts_db
6250
- . verify_accounts_hash_in_bg
6251
- . verification_complete( ) ;
6252
- true
6253
- }
6254
- } ) ;
6255
-
6256
6263
info ! ( "Verifying bank..." ) ;
6257
6264
let ( verified_bank, verify_bank_time_us) = measure_us ! ( self . verify_hash( ) ) ;
6258
6265
info ! ( "Verifying bank... Done." ) ;
0 commit comments