Skip to content

Commit

Permalink
Merge pull request #2890 from sqrrm/display-param-change-value
Browse files Browse the repository at this point in the history
Display changed param value at proposal time, fix #2692
  • Loading branch information
ripcurlx authored Jun 19, 2019
2 parents e52cff8 + 212b779 commit d53c3b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/bisq/core/dao/DaoFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,11 @@ public Coin getMaxReimbursementRequestAmount() {
}

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) {
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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;
Expand Down Expand Up @@ -547,6 +548,14 @@ public void applyProposalPayload(Proposal proposal) {
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(daoFacade.getGenesisBlockHeight());
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");
Expand Down

0 comments on commit d53c3b3

Please sign in to comment.