Skip to content

Commit 6dbbb69

Browse files
committed
First check if Key period is higher than provided
1 parent e6bde77 commit 6dbbb69

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mithril-common/src/crypto_helper/cardano/key_certification.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,21 @@ impl StmInitializerWrapper {
125125

126126
let kes_sk_period = kes_sk.get_period();
127127
let provided_period = kes_period.unwrap_or_default();
128-
if kes_sk_period <= provided_period {
129-
// We need to perform the evolutions
130-
for period in kes_sk_period..provided_period {
131-
kes_sk
132-
.update()
133-
.map_err(|_| ProtocolInitializerErrorWrapper::KesUpdate(period))?;
134-
}
135-
136-
Some(kes_sk.sign(&stm_initializer.verification_key().to_bytes()))
137-
} else {
128+
if kes_sk_period > provided_period {
138129
return Err(ProtocolInitializerErrorWrapper::KesMismatch(
139130
kes_sk_period,
140131
provided_period,
141132
));
142133
}
134+
135+
// We need to perform the evolutions
136+
for period in kes_sk_period..provided_period {
137+
kes_sk
138+
.update()
139+
.map_err(|_| ProtocolInitializerErrorWrapper::KesUpdate(period))?;
140+
}
141+
142+
Some(kes_sk.sign(&stm_initializer.verification_key().to_bytes()))
143143
} else {
144144
println!("WARNING: Non certified signer registration by providing only a Pool Id is decommissionned and must be used for tests only!");
145145
None

0 commit comments

Comments
 (0)