Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix request amount bounds in ReimbursementValidator #5077

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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