From 2937d8c55b687a35b793f2aca79f6f8302e664cf Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 06 Jun 2023 14:31:42 +0000 Subject: [PATCH] fix(collator-selection): disable reward transfer when zero --- --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -609,9 +609,12 @@ .checked_sub(&T::Currency::minimum_balance()) .unwrap_or_else(Zero::zero) .div(2u32.into()); - // `reward` is half of pot account minus ED, this should never fail. - let _success = T::Currency::transfer(&pot, &author, reward, Preservation::Preserve); - debug_assert!(_success.is_ok()); + + if !reward.is_zero() { + // `reward` is half of pot account minus ED, this should never fail. + let _success = T::Currency::transfer(&pot, &author, reward, Preservation::Preserve); + debug_assert!(_success.is_ok()); + } >::insert(author, frame_system::Pallet::::block_number()); frame_system::Pallet::::register_extra_weight_unchecked( -- gitstuff