File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
client/consensus/babe/src Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ impl Config {
285285 C : AuxStore + ProvideRuntimeApi < B > , C :: Api : BabeApi < B , Error = sp_blockchain:: Error > ,
286286 {
287287 trace ! ( target: "babe" , "Getting slot duration" ) ;
288- match sc_consensus_slots:: SlotDuration :: get_or_compute ( client, |a, b| {
288+ let config = match sc_consensus_slots:: SlotDuration :: get_or_compute ( client, |a, b| {
289289 let has_api_v1 = a. has_api_with :: < dyn BabeApi < B , Error = sp_blockchain:: Error > , _ > (
290290 & b, |v| v == 1 ,
291291 ) ?;
@@ -310,7 +310,15 @@ impl Config {
310310 warn ! ( target: "babe" , "Failed to get slot duration" ) ;
311311 Err ( s)
312312 }
313+ } ?;
314+
315+ if config. slot_duration == 0 {
316+ return Err ( sp_blockchain:: Error :: Msg (
317+ "Invalid value for slot_duration: the value must be greater than 0." . to_string ( ) ,
318+ ) )
313319 }
320+
321+ Ok ( config)
314322 }
315323}
316324
You can’t perform that action at this time.
0 commit comments