Skip to content

Commit

Permalink
Prefer StoreOpener::new to StoreOpener::with_default_config (#6937)
Browse files Browse the repository at this point in the history
Whenever NearConfig is available, use StoreConfig from it rather than
assuming default store configuration when creating StoreOpener (and
thus opening storage).  This will become important when path is added
to the configuration.

With this change, the only remaining uses of with_default_config are
in test code where we would use default store configuration anyway.

Issue: #6857
  • Loading branch information
mina86 authored Jun 1, 2022
1 parent 0526334 commit 94b17ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion genesis-tools/genesis-populate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn main() {
let near_config = load_config(home_dir, GenesisValidationMode::Full)
.unwrap_or_else(|e| panic!("Error loading config: {:#}", e));

let store = near_store::StoreOpener::with_default_config().home(home_dir).open();
let store = near_store::StoreOpener::new(&near_config.config.store).home(home_dir).open();
GenesisBuilder::from_config_and_store(home_dir, Arc::new(near_config.genesis), store)
.add_additional_accounts(additional_accounts_num)
.add_additional_accounts_contract(near_test_contracts::trivial_contract().to_vec())
Expand Down
2 changes: 1 addition & 1 deletion test-utils/store-validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() {
let near_config = load_config(home_dir, GenesisValidationMode::Full)
.unwrap_or_else(|e| panic!("Error loading config: {:#}", e));

let store = near_store::StoreOpener::with_default_config().home(home_dir).open();
let store = near_store::StoreOpener::new(&near_config.config.store).home(home_dir).open();

let runtime_adapter: Arc<dyn RuntimeAdapter> =
Arc::new(nearcore::NightshadeRuntime::from_config(home_dir, store.clone(), &near_config));
Expand Down

0 comments on commit 94b17ce

Please sign in to comment.