Removed score and compute from set_emergency_election_result (#9271)

* Removed score and compute from set_emergency_election_result

* Supports type incorrectly set to A

* Typo
This commit is contained in:
Leonardo Custodio
2021-07-06 07:04:40 -03:00
committed by GitHub
parent e755577c3f
commit 279ff4b6e6
@@ -401,6 +401,8 @@ pub enum ElectionCompute {
Signed, Signed,
/// Election was computed with an unsigned submission. /// Election was computed with an unsigned submission.
Unsigned, Unsigned,
/// Election was computed with emergency status.
Emergency,
} }
impl Default for ElectionCompute { impl Default for ElectionCompute {
@@ -895,7 +897,7 @@ pub mod pallet {
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))] #[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
pub fn set_emergency_election_result( pub fn set_emergency_election_result(
origin: OriginFor<T>, origin: OriginFor<T>,
solution: ReadySolution<T::AccountId>, supports: Supports<T::AccountId>,
) -> DispatchResult { ) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?; T::ForceOrigin::ensure_origin(origin)?;
ensure!(Self::current_phase().is_emergency(), <Error<T>>::CallNotAllowed); ensure!(Self::current_phase().is_emergency(), <Error<T>>::CallNotAllowed);
@@ -903,6 +905,12 @@ pub mod pallet {
// Note: we don't `rotate_round` at this point; the next call to // Note: we don't `rotate_round` at this point; the next call to
// `ElectionProvider::elect` will succeed and take care of that. // `ElectionProvider::elect` will succeed and take care of that.
let solution = ReadySolution {
supports,
score: [0, 0, 0],
compute: ElectionCompute::Emergency,
};
<QueuedSolution<T>>::put(solution); <QueuedSolution<T>>::put(solution);
Ok(()) Ok(())
} }