@@ -146,34 +146,34 @@ impl Launcher {
146146 let store = shared. store ( ) ;
147147 let stored_spec_hash = store. get_chain_spec_hash ( ) ;
148148
149- if stored_spec_hash. is_none ( ) {
149+ if let Some ( stored_hash) = stored_spec_hash {
150+ if stored_hash == self . args . chain_spec_hash {
151+ // stored == configured
152+ // do nothing
153+ } else if self . args . overwrite_chain_spec {
154+ // stored != configured with --overwrite-spec
155+ self . write_chain_spec_hash ( store) ?;
156+ info ! (
157+ "Overwrite chain spec hash from {} to {}" ,
158+ stored_hash, self . args. overwrite_chain_spec,
159+ ) ;
160+ } else if self . args . skip_chain_spec_check {
161+ // stored != configured with --skip-spec-check
162+ // do nothing
163+ } else {
164+ // stored != configured
165+ eprintln ! (
166+ "chain_spec_hash mismatch: Config({}), storage({}). \
167+ If the two chains are compatible, pass command line argument --skip-spec-check; \
168+ otherwise, pass --overwrite-spec to enforce overriding the stored chain spec with the configured one.",
169+ self . args. chain_spec_hash, stored_hash
170+ ) ;
171+ return Err ( ExitCode :: Config ) ;
172+ }
173+ } else {
150174 // fresh yet
151175 self . write_chain_spec_hash ( store) ?;
152176 info ! ( "Touch chain spec hash: {}" , self . args. chain_spec_hash) ;
153- } else if stored_spec_hash. as_ref ( ) == Some ( & self . args . chain_spec_hash ) {
154- // stored == configured
155- // do nothing
156- } else if self . args . overwrite_chain_spec {
157- // stored != configured with --overwrite-spec
158- self . write_chain_spec_hash ( store) ?;
159- info ! (
160- "Overwrite chain spec hash from {} to {}" ,
161- stored_spec_hash. expect( "checked" ) ,
162- self . args. overwrite_chain_spec,
163- ) ;
164- } else if self . args . skip_chain_spec_check {
165- // stored != configured with --skip-spec-check
166- // do nothing
167- } else {
168- // stored != configured
169- eprintln ! (
170- "chain_spec_hash mismatch: Config({}), storage({}). \
171- If the two chains are compatible, pass command line argument --skip-spec-check; \
172- otherwise, pass --overwrite-spec to enforce overriding the stored chain spec with the configured one.",
173- self . args. chain_spec_hash,
174- stored_spec_hash. expect( "checked" )
175- ) ;
176- return Err ( ExitCode :: Config ) ;
177177 }
178178 Ok ( ( ) )
179179 }
0 commit comments