fixed set_operational in GRANDPA pallet (#1226)

This commit is contained in:
Svyatoslav Nikolsky
2021-11-24 14:13:27 +03:00
committed by Bastian Köcher
parent bbf8b51f9c
commit 5beeb9b4d6
+7 -3
View File
@@ -239,7 +239,7 @@ pub mod pallet {
operational: bool, operational: bool,
) -> DispatchResultWithPostInfo { ) -> DispatchResultWithPostInfo {
ensure_owner_or_root::<T, I>(origin)?; ensure_owner_or_root::<T, I>(origin)?;
<IsHalted<T, I>>::put(operational); <IsHalted<T, I>>::put(!operational);
if operational { if operational {
log::info!(target: "runtime::bridge-grandpa", "Resuming pallet operations."); log::info!(target: "runtime::bridge-grandpa", "Resuming pallet operations.");
@@ -804,9 +804,13 @@ mod tests {
#[test] #[test]
fn pallet_rejects_transactions_if_halted() { fn pallet_rejects_transactions_if_halted() {
run_test(|| { run_test(|| {
<IsHalted<TestRuntime>>::put(true); initialize_substrate_bridge();
assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::Halted,); assert_ok!(Pallet::<TestRuntime>::set_operational(Origin::root(), false));
assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::Halted);
assert_ok!(Pallet::<TestRuntime>::set_operational(Origin::root(), true));
assert_ok!(submit_finality_proof(1));
}) })
} }