Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwolff authored and hayesgm committed Mar 6, 2021
1 parent b84eae1 commit 8a2fda1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pallets/cash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ fn has_requisite_signatures(notice_state: NoticeState, validators: &Vec<Validato
impl<T: Config> pallet_session::ShouldEndSession<T::BlockNumber> for Module<T> {
fn should_end_session(now: T::BlockNumber) -> bool {
if NextValidators::iter().count() > 0 {
println!("should_end_session=true[next_validators]");
true
} else if NoticeHold::iter().count() > 0 {
// Check if we should end the hold
Expand All @@ -421,14 +422,23 @@ impl<T: Config> pallet_session::ShouldEndSession<T::BlockNumber> for Module<T> {
for (chain_id, _) in NoticeHold::iter() {
NoticeHold::take(chain_id);
}
println!("should_end_session=true[notices_executed]");
true
} else {
println!("should_end_session=false[notices_held]");
false
}
} else {
// no era changes pending, periodic
let period: T::BlockNumber = <T>::BlockNumber::from(params::SESSION_PERIOD as u32);
let is_new_period = (now % period) == <T>::BlockNumber::from(0 as u32);

if is_new_period {
println!(
"should_end_session={}[periodic {:?}%{:?}]",
is_new_period, now, period
);
}
is_new_period
}
}
Expand Down

0 comments on commit 8a2fda1

Please sign in to comment.