From e0dca7d8045e107672ed57d3b63d454b87d27e6b Mon Sep 17 00:00:00 2001 From: Steven Barclay Date: Mon, 11 Jan 2021 20:13:41 +0000 Subject: [PATCH] Fix request amount bounds in ReimbursementValidator 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. --- .../reimbursement/ReimbursementValidator.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/bisq/core/dao/governance/proposal/reimbursement/ReimbursementValidator.java b/core/src/main/java/bisq/core/dao/governance/proposal/reimbursement/ReimbursementValidator.java index 23b7c9d84e1..4a80c994500 100644 --- a/core/src/main/java/bisq/core/dao/governance/proposal/reimbursement/ReimbursementValidator.java +++ b/core/src/main/java/bisq/core/dao/governance/proposal/reimbursement/ReimbursementValidator.java @@ -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; @@ -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) {