diff --git a/nearcore/src/lib.rs b/nearcore/src/lib.rs index c178e6957ab..a3cca2d6390 100644 --- a/nearcore/src/lib.rs +++ b/nearcore/src/lib.rs @@ -42,7 +42,17 @@ pub fn get_default_home() -> PathBuf { } /// Opens node’s storage performing migrations and checks when necessary. -fn open_storage(home_dir: &Path, near_config: &NearConfig) -> anyhow::Result { +/// +/// If opened storage is an RPC store and `near_config.config.archive` is true, +/// converts the storage to archival node. Otherwise, if opening archival node +/// with that field being false, prints a warning and sets the field to `true`. +/// In other words, once store is archival, the node will act as archival nod +/// regardless of settings in `config.json`. +/// +/// The end goal is to get rid of `archive` option in `config.json` file and +/// have the type of the node be determined purely based on kind of database +/// being opened. +fn open_storage(home_dir: &Path, near_config: &mut NearConfig) -> anyhow::Result { let migrator = migrations::Migrator::new(near_config); let opener = NodeStorage::opener(home_dir, &near_config.config.store).with_migrator(&migrator); let res = match opener.open() { @@ -110,20 +120,22 @@ fn open_storage(home_dir: &Path, near_config: &NearConfig) -> anyhow::Result anyhow::Result< pub fn start_with_config_and_synchronization( home_dir: &Path, - config: NearConfig, + mut config: NearConfig, // 'shutdown_signal' will notify the corresponding `oneshot::Receiver` when an instance of // `ClientActor` gets dropped. shutdown_signal: Option>, ) -> anyhow::Result { - let store = open_storage(home_dir, &config)?; + let store = open_storage(home_dir, &mut config)?; let runtime = Arc::new(NightshadeRuntime::from_config( home_dir, diff --git a/neard/src/cli.rs b/neard/src/cli.rs index 88253291504..e16b476129d 100644 --- a/neard/src/cli.rs +++ b/neard/src/cli.rs @@ -287,7 +287,9 @@ impl InitCmd { #[derive(Parser)] pub(super) struct RunCmd { - /// Keep old blocks in the storage (default false). + /// Configure node to run as archival node which prevents deletion of old + /// blocks. This is a persistent setting; once client is started as + /// archival node, it cannot be run in non-archival mode. #[clap(long)] archive: bool, /// Set the boot nodes to bootstrap network from.