diff --git a/core/src/main/java/bisq/core/dao/governance/votereveal/VoteRevealService.java b/core/src/main/java/bisq/core/dao/governance/votereveal/VoteRevealService.java index de859c88668..7b1762b5a88 100644 --- a/core/src/main/java/bisq/core/dao/governance/votereveal/VoteRevealService.java +++ b/core/src/main/java/bisq/core/dao/governance/votereveal/VoteRevealService.java @@ -75,6 +75,10 @@ public interface VoteRevealTxPublishedListener { void onVoteRevealTxPublished(String txId); } + public interface VoteRevealTxFailedListener { + void onVoteRevealTxFailed(VoteRevealException exception); + } + private final DaoStateService daoStateService; private final BlindVoteListService blindVoteListService; private final PeriodService periodService; @@ -87,6 +91,7 @@ public interface VoteRevealTxPublishedListener { @Getter private final ObservableList voteRevealExceptions = FXCollections.observableArrayList(); private final List voteRevealTxPublishedListeners = new ArrayList<>(); + private final List voteRevealTxFailedListeners = new ArrayList<>(); /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -147,6 +152,10 @@ public void addVoteRevealTxPublishedListener(VoteRevealTxPublishedListener voteR voteRevealTxPublishedListeners.add(voteRevealTxPublishedListener); } + public void addVoteRevealTxFailedListener(VoteRevealTxFailedListener voteRevealTxFailedListener) { + voteRevealTxFailedListeners.add(voteRevealTxFailedListener); + } + /////////////////////////////////////////////////////////////////////////////////////////// // DaoStateListener @@ -252,6 +261,9 @@ private void revealVote(MyVote myVote, boolean isInVoteRevealPhase) { } catch (VoteRevealException e) { voteRevealExceptions.add(e); } + + //Display vote reveal exceptions + voteRevealExceptions.forEach(e -> voteRevealTxFailedListeners.forEach(l -> l.onVoteRevealTxFailed(e))); } private void publishTx(Transaction voteRevealTx) { diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 2173fe5a929..f2d349ad023 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1492,6 +1492,9 @@ dao.cycle.phaseDurationWithoutBlocks=Block {0} - {1} (≈{2} - ≈{3}) dao.voteReveal.txPublished.headLine=Vote reveal transaction published dao.voteReveal.txPublished=Your vote reveal transaction with transaction ID {0} was successfully published.\n\n\ This happens automatically by the software if you have participated in the DAO voting. +dao.voteReveal.txFailed.headLine=Vote reveal transaction failed +dao.voteReveal.txPublished=Your vote reveal transaction with transaction ID {0} failed.\n\n\ + Reason was: {1}. dao.results.cycles.header=Cycles dao.results.cycles.table.header.cycle=Cycle diff --git a/desktop/src/main/java/bisq/desktop/main/dao/DaoView.java b/desktop/src/main/java/bisq/desktop/main/dao/DaoView.java index 3003ba1f41d..7787db75172 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/DaoView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/DaoView.java @@ -79,6 +79,12 @@ private DaoView(CachingViewLoader viewLoader, VoteRevealService voteRevealServic .feedback(Res.get("dao.voteReveal.txPublished", txId)) .show(); }); + + voteRevealService.addVoteRevealTxFailedListener((exception) -> { + new Popup<>().headLine(Res.get("dao.voteReveal.txFailed.headLine")) + .error(Res.get("dao.voteReveal.txFailed", exception.getBlindVoteTxId(), exception.getLocalizedMessage())) + .show(); + }); } @Override