[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
+5
View File
@@ -372,6 +372,11 @@ fn instapool_payouts_work() {
advance_to(11);
assert_eq!(pot(), 14);
assert_eq!(revenue(), 106);
// Cannot claim for 0 timeslices.
assert_noop!(Broker::do_claim_revenue(region, 0), Error::<Test>::NoClaimTimeslices);
// Revenue can be claimed.
assert_ok!(Broker::do_claim_revenue(region, 100));
assert_eq!(pot(), 10);
assert_eq!(balance(2), 4);