Skip to content

Commit

Permalink
Fix incorrect available balance for voting
Browse files Browse the repository at this point in the history
- Subtract vote fee from available wallet balance
- Add log for errors
- Update view in error case
  • Loading branch information
ManfredKarrer committed Feb 24, 2019
1 parent fb5c983 commit e52ac9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit e52ac9d

Please sign in to comment.