[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 authored and GitHub committed 2024-04-05 13:18:48 +00:00
1 parent d3eba3692d
commit ba0f8de0c7
4 files changed
+29 -6

No files matched your search

@@ -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();