Display changed param value at proposal time, fix #2692

This commit is contained in:
sqrrm 2019-06-16 15:49:30 +02:00
parent abc0909ffe
commit 29c48e9548
No known key found for this signature in database
GPG Key ID: 45235F9EF87089EC
3 changed files with 15 additions and 1 deletions

View File

@ -689,7 +689,11 @@ public class DaoFacade implements DaoSetupService {
}
public String getParamValue(Param param) {
return daoStateService.getParamValue(param, periodService.getChainHeight());
return getParamValue(param, periodService.getChainHeight());
}
public String getParamValue(Param param, int blockHeight) {
return daoStateService.getParamValue(param, blockHeight);
}
public void resyncDao(Runnable resultHandler) {

View File

@ -1473,6 +1473,7 @@ dao.param.BONDED_ROLE_FACTOR=Bonded role unit factor in BSQ
dao.param.ISSUANCE_LIMIT=Issuance limit per cycle in BSQ
dao.param.currentValue=Current value: {0}
dao.param.currentAndPastValue=Current value: {0} (Value when proposal was made: {1})
dao.param.blocks={0} blocks
dao.results.cycle.duration.label=Duration of {0}

View File

@ -39,6 +39,7 @@ import bisq.core.dao.governance.param.Param;
import bisq.core.dao.governance.proposal.ProposalType;
import bisq.core.dao.governance.proposal.param.ChangeParamInputValidator;
import bisq.core.dao.governance.proposal.param.ChangeParamValidator;
import bisq.core.dao.state.model.blockchain.BaseTx;
import bisq.core.dao.state.model.blockchain.Tx;
import bisq.core.dao.state.model.governance.Ballot;
import bisq.core.dao.state.model.governance.BondedRoleType;
@ -542,6 +543,14 @@ public class ProposalDisplay {
comboBoxValueTextField.setText(paramComboBox.getConverter().toString(changeParamProposal.getParam()));
checkNotNull(paramValueTextField, "paramValueTextField must not be null");
paramValueTextField.setText(bsqFormatter.formatParamValue(changeParamProposal.getParam(), changeParamProposal.getParamValue()));
String currentValue = bsqFormatter.formatParamValue(changeParamProposal.getParam(),
daoFacade.getParamValue(changeParamProposal.getParam()));
int height = daoFacade.getTx(changeParamProposal.getTxId())
.map(BaseTx::getBlockHeight)
.orElse(1);
String valueAtProposal = bsqFormatter.formatParamValue(changeParamProposal.getParam(),
daoFacade.getParamValue(changeParamProposal.getParam(), height));
paramValueTextField.setPromptText(Res.get("dao.param.currentAndPastValue", currentValue, valueAtProposal));
} else if (proposal instanceof RoleProposal) {
RoleProposal roleProposal = (RoleProposal) proposal;
checkNotNull(bondedRoleTypeComboBox, "bondedRoleComboBox must not be null");