Skip to content

Commit

Permalink
Merge pull request #5077 from stejbac/fix-reimbursement-validator
Browse files Browse the repository at this point in the history
Fix request amount bounds in ReimbursementValidator
  • Loading branch information
ripcurlx authored Jan 19, 2021
2 parents 071e1e5 + e0dca7d commit 728439e
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 728439e

Please sign in to comment.