Skip to content

Commit

Permalink
Fix request amount bounds in ReimbursementValidator
Browse files Browse the repository at this point in the history
Use ReimbursementConsensus.get[Min|Max]ReimbursementRequestAmount in
place of CompensationConsensus.get[Min|Max]CompensationRequestAmount,
which was erroneously copied (it appears) from the very similar
CompensationValidator class.

This ensures the correct upper bound (currently 80,000 BSQ, starting at
10,000 BSQ and doubled in cycles 12, 13 & 14) is placed on reimbursement
requests, instead of the erroneous 100,000 BSQ upper bound for
compensation requests.
  • Loading branch information
stejbac committed Jan 11, 2021
1 parent 917637c commit e0dca7d
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import bisq.core.dao.governance.period.PeriodService;
import bisq.core.dao.governance.proposal.ProposalValidationException;
import bisq.core.dao.governance.proposal.ProposalValidator;
import bisq.core.dao.governance.proposal.compensation.CompensationConsensus;
import bisq.core.dao.state.DaoStateService;
import bisq.core.dao.state.model.governance.Proposal;
import bisq.core.dao.state.model.governance.ReimbursementProposal;
Expand Down Expand Up @@ -59,12 +58,12 @@ public void validateDataFields(Proposal proposal) throws ProposalValidationExcep

Coin requestedBsq = reimbursementProposal.getRequestedBsq();
int chainHeight = getBlockHeight(proposal);
Coin maxCompensationRequestAmount = CompensationConsensus.getMaxCompensationRequestAmount(daoStateService, chainHeight);
checkArgument(requestedBsq.compareTo(maxCompensationRequestAmount) <= 0,
"Requested BSQ must not exceed " + (maxCompensationRequestAmount.value / 100L) + " BSQ");
Coin minCompensationRequestAmount = CompensationConsensus.getMinCompensationRequestAmount(daoStateService, chainHeight);
checkArgument(requestedBsq.compareTo(minCompensationRequestAmount) >= 0,
"Requested BSQ must not be less than " + (minCompensationRequestAmount.value / 100L) + " BSQ");
Coin maxReimbursementRequestAmount = ReimbursementConsensus.getMaxReimbursementRequestAmount(daoStateService, chainHeight);
checkArgument(requestedBsq.compareTo(maxReimbursementRequestAmount) <= 0,
"Requested BSQ must not exceed " + (maxReimbursementRequestAmount.value / 100L) + " BSQ");
Coin minReimbursementRequestAmount = ReimbursementConsensus.getMinReimbursementRequestAmount(daoStateService, chainHeight);
checkArgument(requestedBsq.compareTo(minReimbursementRequestAmount) >= 0,
"Requested BSQ must not be less than " + (minReimbursementRequestAmount.value / 100L) + " BSQ");
} catch (ProposalValidationException e) {
throw e;
} catch (Throwable throwable) {
Expand Down

0 comments on commit e0dca7d

Please sign in to comment.