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 incorrect available balance for voting #2462

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
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ public void publishBlindVote(Coin stake, ResultHandler resultHandler, ExceptionH
publishTx(resultHandler, exceptionHandler, blindVoteTx);
} catch (CryptoException | TransactionVerificationException | InsufficientMoneyException |
WalletException | IOException exception) {
log.error(exception.toString());
exception.printStackTrace();
exceptionHandler.handleException(exception);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import bisq.core.btc.listeners.BsqBalanceListener;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.dao.governance.blindvote.BlindVoteConsensus;
import bisq.core.dao.governance.myvote.MyVote;
import bisq.core.dao.governance.proposal.param.ChangeParamValidator;
import bisq.core.dao.state.DaoStateListener;
Expand Down Expand Up @@ -261,10 +262,12 @@ public void onUpdateBalances(Coin confirmedBalance,
Coin lockedForVotingBalance,
Coin lockupBondsBalance,
Coin unlockingBondsBalance) {
if (isBlindVotePhaseButNotLastBlock())
Coin blindVoteFee = BlindVoteConsensus.getFee(daoStateService, daoStateService.getChainHeight());
if (isBlindVotePhaseButNotLastBlock()) {
Coin availableForVoting = confirmedBalance.subtract(blindVoteFee);
stakeInputTextField.setPromptText(Res.get("dao.proposal.myVote.stake.prompt",
bsqFormatter.formatCoinWithCode(confirmedBalance)));
else
bsqFormatter.formatCoinWithCode(availableForVoting)));
} else
stakeInputTextField.setPromptText("");
}

Expand Down Expand Up @@ -523,6 +526,7 @@ private void publishBlindVote(Coin stake) {
}, exception -> {
voteButtonBusyAnimation.stop();
voteButtonInfoLabel.setText("");
updateViews();
new Popup<>().warning(exception.toString()).show();
});

Expand Down