[pallet-broker] Fix claim revenue behaviour for zero timeslices (#3997)

This PR adds a check that `max_timeslices > 0` and errors if not. It
also adds a test for this behaviour and cleans up some misleading docs.
This commit is contained in:
Dónal Murray
2024-04-05 14:18:48 +01:00
committed by GitHub
parent d3eba3692d
commit ba0f8de0c7
4 changed files with 29 additions and 6 deletions
@@ -329,6 +329,7 @@ impl<T: Config> Pallet<T> {
mut region: RegionId,
max_timeslices: Timeslice,
) -> DispatchResult {
ensure!(max_timeslices > 0, Error::<T>::NoClaimTimeslices);
let mut contribution =
InstaPoolContribution::<T>::take(region).ok_or(Error::<T>::UnknownContribution)?;
let contributed_parts = region.mask.count_ones();