add ledger-tool verify option to verify hash calculation (#17412)
This commit is contained in:
committed by
GitHub
parent
d4fc9e7ed4
commit
99313a4ba2
@ -762,6 +762,9 @@ fn main() {
|
|||||||
.value_name("PATHS")
|
.value_name("PATHS")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Comma separated persistent accounts location");
|
.help("Comma separated persistent accounts location");
|
||||||
|
let accounts_db_test_hash_calculation_arg = Arg::with_name("accounts_db_test_hash_calculation")
|
||||||
|
.long("accounts-db-test-hash-calculation")
|
||||||
|
.help("Enable hash calculation test");
|
||||||
let halt_at_slot_arg = Arg::with_name("halt_at_slot")
|
let halt_at_slot_arg = Arg::with_name("halt_at_slot")
|
||||||
.long("halt-at-slot")
|
.long("halt-at-slot")
|
||||||
.value_name("SLOT")
|
.value_name("SLOT")
|
||||||
@ -1039,6 +1042,7 @@ fn main() {
|
|||||||
.arg(&halt_at_slot_arg)
|
.arg(&halt_at_slot_arg)
|
||||||
.arg(&hard_forks_arg)
|
.arg(&hard_forks_arg)
|
||||||
.arg(&no_accounts_db_caching_arg)
|
.arg(&no_accounts_db_caching_arg)
|
||||||
|
.arg(&accounts_db_test_hash_calculation_arg)
|
||||||
.arg(&no_bpf_jit_arg)
|
.arg(&no_bpf_jit_arg)
|
||||||
.arg(&allow_dead_slots_arg)
|
.arg(&allow_dead_slots_arg)
|
||||||
.arg(&max_genesis_archive_unpacked_size_arg)
|
.arg(&max_genesis_archive_unpacked_size_arg)
|
||||||
@ -1741,6 +1745,8 @@ fn main() {
|
|||||||
bpf_jit: !matches.is_present("no_bpf_jit"),
|
bpf_jit: !matches.is_present("no_bpf_jit"),
|
||||||
accounts_db_caching_enabled: !arg_matches.is_present("no_accounts_db_caching"),
|
accounts_db_caching_enabled: !arg_matches.is_present("no_accounts_db_caching"),
|
||||||
allow_dead_slots: arg_matches.is_present("allow_dead_slots"),
|
allow_dead_slots: arg_matches.is_present("allow_dead_slots"),
|
||||||
|
accounts_db_test_hash_calculation: arg_matches
|
||||||
|
.is_present("accounts_db_test_hash_calculation"),
|
||||||
..ProcessOptions::default()
|
..ProcessOptions::default()
|
||||||
};
|
};
|
||||||
let print_accounts_stats = arg_matches.is_present("print_accounts_stats");
|
let print_accounts_stats = arg_matches.is_present("print_accounts_stats");
|
||||||
|
@ -82,6 +82,10 @@ pub fn load(
|
|||||||
deserialized_bank.get_accounts_hash(),
|
deserialized_bank.get_accounts_hash(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if process_options.accounts_db_test_hash_calculation {
|
||||||
|
deserialized_bank.update_accounts_hash_with_index_option(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
if deserialized_snapshot_hash != (archive_slot, archive_snapshot_hash) {
|
if deserialized_snapshot_hash != (archive_slot, archive_snapshot_hash) {
|
||||||
error!(
|
error!(
|
||||||
"Snapshot has mismatch:\narchive: {:?}\ndeserialized: {:?}",
|
"Snapshot has mismatch:\narchive: {:?}\ndeserialized: {:?}",
|
||||||
|
@ -369,6 +369,7 @@ pub struct ProcessOptions {
|
|||||||
pub account_indexes: AccountSecondaryIndexes,
|
pub account_indexes: AccountSecondaryIndexes,
|
||||||
pub accounts_db_caching_enabled: bool,
|
pub accounts_db_caching_enabled: bool,
|
||||||
pub allow_dead_slots: bool,
|
pub allow_dead_slots: bool,
|
||||||
|
pub accounts_db_test_hash_calculation: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_blockstore(
|
pub fn process_blockstore(
|
||||||
|
Reference in New Issue
Block a user