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

Remind user when their DAO state needs to be refreshed #5552

Merged
merged 1 commit into from Jun 8, 2021
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
7 changes: 7 additions & 0 deletions core/src/main/java/bisq/core/dao/DaoFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import bisq.core.dao.governance.proposal.reimbursement.ReimbursementProposalFactory;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetProposalFactory;
import bisq.core.dao.governance.proposal.role.RoleProposalFactory;
import bisq.core.dao.monitoring.DaoStateMonitoringService;
import bisq.core.dao.state.DaoStateListener;
import bisq.core.dao.state.DaoStateService;
import bisq.core.dao.state.model.blockchain.BaseTx;
Expand Down Expand Up @@ -124,6 +125,7 @@ public class DaoFacade implements DaoSetupService {
private final BallotListPresentation ballotListPresentation;
private final MyProposalListService myProposalListService;
private final DaoStateService daoStateService;
private final DaoStateMonitoringService daoStateMonitoringService;
private final PeriodService periodService;
private final MyBlindVoteListService myBlindVoteListService;
private final MyVoteListService myVoteListService;
Expand All @@ -150,6 +152,7 @@ public DaoFacade(MyProposalListService myProposalListService,
BallotListService ballotListService,
BallotListPresentation ballotListPresentation,
DaoStateService daoStateService,
DaoStateMonitoringService daoStateMonitoringService,
PeriodService periodService,
MyBlindVoteListService myBlindVoteListService,
MyVoteListService myVoteListService,
Expand All @@ -172,6 +175,7 @@ public DaoFacade(MyProposalListService myProposalListService,
this.ballotListPresentation = ballotListPresentation;
this.myProposalListService = myProposalListService;
this.daoStateService = daoStateService;
this.daoStateMonitoringService = daoStateMonitoringService;
this.periodService = periodService;
this.myBlindVoteListService = myBlindVoteListService;
this.myVoteListService = myVoteListService;
Expand Down Expand Up @@ -522,6 +526,9 @@ public Optional<Block> getBlockAtHeight(int chainHeight) {
return daoStateService.getBlockAtHeight(chainHeight);
}

public boolean isInConflictWithSeedNode() {
return daoStateMonitoringService.isInConflictWithSeedNode();
}

///////////////////////////////////////////////////////////////////////////////////////////
// Use case: Bonding
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2848,6 +2848,7 @@ popup.warning.notSufficientConnectionsToBtcNetwork=You need to wait until you ha
popup.warning.downloadNotComplete=You need to wait until the download of missing Bitcoin blocks is complete.
popup.warning.chainNotSynced=The Bisq wallet blockchain height is not synced correctly. If you recently started the application, please wait until one Bitcoin block has been published.\n\n\
You can check the blockchain height in Settings/Network Info. If more than one block passes and this problem persists it may be stalled, in which case you should do an SPV resync. [HYPERLINK:https://bisq.wiki/Resyncing_SPV_file]
popup.warning.daoNeedsResync=Your Bisq DAO state needs to be resynced.\n\nPlease navigate to DAO Network Monitor menu and follow the prompts to resync the DAO state.
popup.warning.removeOffer=Are you sure you want to remove that offer?\nThe maker fee of {0} will be lost if you remove that offer.
popup.warning.tooLargePercentageValue=You cannot set a percentage of 100% or larger.
popup.warning.examplePercentageValue=Please enter a percentage number like \"5.4\" for 5.4%
Expand Down Expand Up @@ -3121,6 +3122,7 @@ navigation.settings.preferences=\"Settings/Preferences\"
navigation.funds.transactions=\"Funds/Transactions\"
navigation.support=\"Support\"
navigation.dao.wallet.receive=\"DAO/BSQ Wallet/Receive\"
navigation.dao.networkMonitor=\"DAO Network Monitor\"


####################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package bisq.desktop.main.presentation;

import bisq.desktop.Navigation;
import bisq.desktop.util.GUIUtil;

import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.DaoFacade;
Expand Down Expand Up @@ -32,6 +35,7 @@ public class DaoPresentation implements DaoStateListener {
public static final String DAO_NEWS = "daoNewsVersion1.0.0";

private final Preferences preferences;
private final Navigation navigation;
private final BtcWalletService btcWalletService;
private final DaoFacade daoFacade;
private final BsqWalletService bsqWalletService;
Expand All @@ -44,14 +48,17 @@ public class DaoPresentation implements DaoStateListener {
@Getter
private final StringProperty bsqInfo = new SimpleStringProperty("");
private final SimpleBooleanProperty showNotification = new SimpleBooleanProperty(false);
private boolean daoConflictWarningShown = false; // allow only one conflict warning per session

@Inject
public DaoPresentation(Preferences preferences,
Navigation navigation,
BtcWalletService btcWalletService,
BsqWalletService bsqWalletService,
DaoStateService daoStateService,
DaoFacade daoFacade) {
this.preferences = preferences;
this.navigation = navigation;
this.btcWalletService = btcWalletService;
this.bsqWalletService = bsqWalletService;
this.daoFacade = daoFacade;
Expand Down Expand Up @@ -91,6 +98,10 @@ private void onUpdateAnyChainHeight() {

if (synced) {
bsqInfo.set("");
if (daoFacade.isInConflictWithSeedNode() && !daoConflictWarningShown) {
daoConflictWarningShown = true; // only warn max 1 time per session so as not to annoy
GUIUtil.showDaoNeedsResyncPopup(navigation);
}
} else {
bsqInfo.set(Res.get("mainView.footer.bsqInfo.synchronizing"));
}
Expand Down
12 changes: 12 additions & 0 deletions desktop/src/main/java/bisq/desktop/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
import bisq.desktop.main.dao.DaoView;
import bisq.desktop.main.dao.monitor.MonitorView;
import bisq.desktop.main.dao.monitor.daostate.DaoStateMonitorView;
import bisq.desktop.main.overlays.popups.Popup;

import bisq.core.account.witness.AccountAgeWitness;
Expand Down Expand Up @@ -757,6 +760,15 @@ public static boolean isBootstrappedOrShowPopup(P2PService p2PService) {
return true;
}

public static void showDaoNeedsResyncPopup(Navigation navigation) {
UserThread.runAfter(() -> new Popup().warning(Res.get("popup.warning.daoNeedsResync"))
.actionButtonTextWithGoTo("navigation.dao.networkMonitor")
.onAction(() -> {
navigation.navigateTo(MainView.class, DaoView.class, MonitorView.class, DaoStateMonitorView.class);
})
.show(), 5, TimeUnit.SECONDS);
}

public static boolean isReadyForTxBroadcastOrShowPopup(P2PService p2PService, WalletsSetup walletsSetup) {
if (!GUIUtil.isBootstrappedOrShowPopup(p2PService)) {
return false;
Expand Down