mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 10:41:01 +00:00
move set_emergency_election_result before submit (#9215)
This commit is contained in:
committed by
GitHub
parent
4d03f71881
commit
ee192467e2
@@ -884,6 +884,29 @@ pub mod pallet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set a solution in the queue, to be handed out to the client of this pallet in the next
|
||||||
|
/// call to `ElectionProvider::elect`.
|
||||||
|
///
|
||||||
|
/// This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`.
|
||||||
|
///
|
||||||
|
/// The solution is not checked for any feasibility and is assumed to be trustworthy, as any
|
||||||
|
/// feasibility check itself can in principle cause the election process to fail (due to
|
||||||
|
/// memory/weight constrains).
|
||||||
|
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
|
||||||
|
pub fn set_emergency_election_result(
|
||||||
|
origin: OriginFor<T>,
|
||||||
|
solution: ReadySolution<T::AccountId>,
|
||||||
|
) -> DispatchResult {
|
||||||
|
T::ForceOrigin::ensure_origin(origin)?;
|
||||||
|
ensure!(Self::current_phase().is_emergency(), <Error<T>>::CallNotAllowed);
|
||||||
|
|
||||||
|
// Note: we don't `rotate_round` at this point; the next call to
|
||||||
|
// `ElectionProvider::elect` will succeed and take care of that.
|
||||||
|
|
||||||
|
<QueuedSolution<T>>::put(solution);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Submit a solution for the signed phase.
|
/// Submit a solution for the signed phase.
|
||||||
///
|
///
|
||||||
/// The dispatch origin fo this call must be __signed__.
|
/// The dispatch origin fo this call must be __signed__.
|
||||||
@@ -956,29 +979,6 @@ pub mod pallet {
|
|||||||
Self::deposit_event(Event::SolutionStored(ElectionCompute::Signed, ejected_a_solution));
|
Self::deposit_event(Event::SolutionStored(ElectionCompute::Signed, ejected_a_solution));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a solution in the queue, to be handed out to the client of this pallet in the next
|
|
||||||
/// call to `ElectionProvider::elect`.
|
|
||||||
///
|
|
||||||
/// This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`.
|
|
||||||
///
|
|
||||||
/// The solution is not checked for any feasibility and is assumed to be trustworthy, as any
|
|
||||||
/// feasibility check itself can in principle cause the election process to fail (due to
|
|
||||||
/// memory/weight constrains).
|
|
||||||
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
|
|
||||||
pub fn set_emergency_election_result(
|
|
||||||
origin: OriginFor<T>,
|
|
||||||
solution: ReadySolution<T::AccountId>,
|
|
||||||
) -> DispatchResult {
|
|
||||||
T::ForceOrigin::ensure_origin(origin)?;
|
|
||||||
ensure!(Self::current_phase().is_emergency(), <Error<T>>::CallNotAllowed);
|
|
||||||
|
|
||||||
// Note: we don't `rotate_round` at this point; the next call to
|
|
||||||
// `ElectionProvider::elect` will succeed and take care of that.
|
|
||||||
|
|
||||||
<QueuedSolution<T>>::put(solution);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::event]
|
#[pallet::event]
|
||||||
|
|||||||
Reference in New Issue
Block a user