diff --git a/pallets/networks/Cargo.toml b/pallets/networks/Cargo.toml index 177ceb9..30ad1a9 100644 --- a/pallets/networks/Cargo.toml +++ b/pallets/networks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ghost-networks" -version = "0.1.4" +version = "0.1.5" license.workspace = true authors.workspace = true edition.workspace = true diff --git a/pallets/networks/src/lib.rs b/pallets/networks/src/lib.rs index cdc0c77..b43a032 100644 --- a/pallets/networks/src/lib.rs +++ b/pallets/networks/src/lib.rs @@ -697,4 +697,13 @@ impl NetworkDataMutateHandler> for Pallet::set(Default::default()); } + + fn trigger_nullification() { + if NullifyNeeded::::get() { + Self::nullify_commission(); + NullifyNeeded::::put(false); + } else { + NullifyNeeded::::put(true); + } + } } diff --git a/pallets/networks/src/tests.rs b/pallets/networks/src/tests.rs index 07d1b1c..9c3a010 100644 --- a/pallets/networks/src/tests.rs +++ b/pallets/networks/src/tests.rs @@ -935,3 +935,15 @@ fn bridged_inflation_era_payout_triggers_need_of_nullification() { assert_eq!(NullifyNeeded::::get(), false); }); } + +#[test] +fn trigger_nullification_works_as_expected() { + ExtBuilder::build() + .execute_with(|| { + assert_eq!(NullifyNeeded::::get(), false); + GhostNetworks::trigger_nullification(); + assert_eq!(NullifyNeeded::::get(), true); + GhostNetworks::trigger_nullification(); + assert_eq!(NullifyNeeded::::get(), false); + }); +} diff --git a/pallets/traits/Cargo.toml b/pallets/traits/Cargo.toml index 170dba4..0bd089d 100644 --- a/pallets/traits/Cargo.toml +++ b/pallets/traits/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ghost-traits" -version = "0.3.20" +version = "0.3.21" license.workspace = true authors.workspace = true edition.workspace = true diff --git a/pallets/traits/src/networks.rs b/pallets/traits/src/networks.rs index 30752c6..eafb8e6 100644 --- a/pallets/traits/src/networks.rs +++ b/pallets/traits/src/networks.rs @@ -38,4 +38,5 @@ pub trait NetworkDataMutateHandler: NetworkDataInspectHandler< ) -> Result<(Balance, Balance), ()>; fn accumulate_commission(commission: &Balance) -> Result; fn nullify_commission(); + fn trigger_nullification(); }