Browse Source

council - unlock voting stake conditions fix

ondratra 4 years ago
parent
commit
b38fcf2c61
1 changed files with 3 additions and 2 deletions
  1. 3 2
      runtime-modules/council/src/lib.rs

+ 3 - 2
runtime-modules/council/src/lib.rs

@@ -562,7 +562,7 @@ impl<T: Trait> ReferendumConnection<T> for Module<T> {
         current_voting_cycle_id: &u64,
     ) -> Result<(), Error<T>> {
         // allow release for very old votes
-        if vote.cycle_id > current_voting_cycle_id + 1 {
+        if *current_voting_cycle_id > vote.cycle_id + 1 {
             return Ok(());
         }
 
@@ -583,7 +583,8 @@ impl<T: Trait> ReferendumConnection<T> for Module<T> {
 
         // at this point vote.cycle_id == current_voting_cycle_id
 
-        if voting_for_winner {
+        // ensure election has ended and voter haven't voted for winner
+        if voting_for_winner || !matches(Stage::<T>::get().stage, CouncilStage::Idle) {
             return Err(Error::CantReleaseStakeNow);
         }