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

Display changed param value at proposal time, fix #2692 #2890

Merged
merged 2 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
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
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 @@ -542,6 +543,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