AcctIdx: handle future config defaults (#19967)
This commit is contained in:
committed by
GitHub
parent
0404e75e96
commit
99f5684dc4
@ -1908,12 +1908,12 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
("verify", Some(arg_matches)) => {
|
("verify", Some(arg_matches)) => {
|
||||||
let accounts_index_config = value_t!(arg_matches, "accounts_index_bins", usize)
|
let mut accounts_index_config = AccountsIndexConfig::default();
|
||||||
.ok()
|
if let Some(bins) = value_t!(matches, "accounts_index_bins", usize).ok() {
|
||||||
.map(|bins| AccountsIndexConfig { bins: Some(bins) });
|
accounts_index_config.bins = Some(bins);
|
||||||
|
}
|
||||||
let accounts_db_config = Some(AccountsDbConfig {
|
let accounts_db_config = Some(AccountsDbConfig {
|
||||||
index: accounts_index_config,
|
index: Some(accounts_index_config),
|
||||||
accounts_hash_cache_path: Some(ledger_path.clone()),
|
accounts_hash_cache_path: Some(ledger_path.clone()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4112,7 +4112,10 @@ pub mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "bins.is_power_of_two()")]
|
#[should_panic(expected = "bins.is_power_of_two()")]
|
||||||
|
#[allow(clippy::field_reassign_with_default)]
|
||||||
fn test_illegal_bins() {
|
fn test_illegal_bins() {
|
||||||
AccountsIndex::<bool>::new(Some(AccountsIndexConfig { bins: Some(3) }));
|
let mut config = AccountsIndexConfig::default();
|
||||||
|
config.bins = Some(3);
|
||||||
|
AccountsIndex::<bool>::new(Some(config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2487,12 +2487,13 @@ pub fn main() {
|
|||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let accounts_index_config = value_t!(matches, "accounts_index_bins", usize)
|
let mut accounts_index_config = AccountsIndexConfig::default();
|
||||||
.ok()
|
if let Some(bins) = value_t!(matches, "accounts_index_bins", usize).ok() {
|
||||||
.map(|bins| AccountsIndexConfig { bins: Some(bins) });
|
accounts_index_config.bins = Some(bins);
|
||||||
|
}
|
||||||
|
|
||||||
let accounts_db_config = Some(AccountsDbConfig {
|
let accounts_db_config = Some(AccountsDbConfig {
|
||||||
index: accounts_index_config,
|
index: Some(accounts_index_config),
|
||||||
accounts_hash_cache_path: Some(ledger_path.clone()),
|
accounts_hash_cache_path: Some(ledger_path.clone()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user