mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-18 19:28:08 -04:00
check that wallet is synced within tolerance
This commit is contained in:
parent
5fc7fef223
commit
9957aa6256
29 changed files with 66 additions and 62 deletions
|
@ -172,7 +172,7 @@ public class TxIdTextField extends AnchorPane {
|
|||
MoneroTx tx = null;
|
||||
try {
|
||||
tx = useCache ? xmrWalletService.getTxWithCache(txId) : xmrWalletService.getTx(txId);
|
||||
tx.setNumConfirmations(tx.isConfirmed() ? (height == null ? xmrWalletService.getConnectionsService().getLastInfo().getHeight() : height) - tx.getHeight(): 0l); // TODO: don't set if tx.getNumConfirmations() works reliably on non-local testnet
|
||||
tx.setNumConfirmations(tx.isConfirmed() ? (height == null ? xmrWalletService.getConnectionService().getLastInfo().getHeight() : height) - tx.getHeight(): 0l); // TODO: don't set if tx.getNumConfirmations() works reliably on non-local testnet
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void onWithdraw() {
|
||||
if (GUIUtil.isReadyForTxBroadcastOrShowPopup(xmrWalletService.getConnectionsService())) {
|
||||
if (GUIUtil.isReadyForTxBroadcastOrShowPopup(xmrWalletService)) {
|
||||
try {
|
||||
|
||||
// get withdraw address
|
||||
|
|
|
@ -553,7 +553,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
|
|||
|
||||
boolean canCreateOrTakeOffer() {
|
||||
return GUIUtil.canCreateOrTakeOfferOrShowPopup(user, navigation) &&
|
||||
GUIUtil.isChainHeightSyncedWithinToleranceOrShowPopup(openOfferManager.getXmrConnectionService()) &&
|
||||
GUIUtil.isWalletSyncedWithinToleranceOrShowPopup(openOfferManager.getXmrWalletService()) &&
|
||||
GUIUtil.isBootstrappedOrShowPopup(p2PService);
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
|
|||
}
|
||||
|
||||
public boolean isReadyForTxBroadcast() {
|
||||
return GUIUtil.isBootstrappedOrShowPopup(p2PService) && GUIUtil.isReadyForTxBroadcastOrShowPopup(xmrConnectionService);
|
||||
return GUIUtil.isBootstrappedOrShowPopup(p2PService) && GUIUtil.isReadyForTxBroadcastOrShowPopup(xmrWalletService);
|
||||
}
|
||||
|
||||
public boolean isBootstrappedOrShowPopup() {
|
||||
|
|
|
@ -689,7 +689,8 @@ public class GUIUtil {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean isReadyForTxBroadcastOrShowPopup(XmrConnectionService xmrConnectionService) {
|
||||
public static boolean isReadyForTxBroadcastOrShowPopup(XmrWalletService xmrWalletService) {
|
||||
XmrConnectionService xmrConnectionService = xmrWalletService.getConnectionService();
|
||||
if (!xmrConnectionService.hasSufficientPeersForBroadcast()) {
|
||||
new Popup().information(Res.get("popup.warning.notSufficientConnectionsToXmrNetwork", xmrConnectionService.getMinBroadcastConnections())).show();
|
||||
return false;
|
||||
|
@ -700,6 +701,10 @@ public class GUIUtil {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!isWalletSyncedWithinToleranceOrShowPopup(xmrWalletService)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
xmrConnectionService.verifyConnection();
|
||||
} catch (Exception e) {
|
||||
|
@ -710,12 +715,11 @@ public class GUIUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean isChainHeightSyncedWithinToleranceOrShowPopup(XmrConnectionService xmrConnectionService) {
|
||||
if (!xmrConnectionService.isSyncedWithinTolerance()) {
|
||||
new Popup().information(Res.get("popup.warning.chainNotSynced")).show();
|
||||
public static boolean isWalletSyncedWithinToleranceOrShowPopup(XmrWalletService xmrWalletService) {
|
||||
if (!xmrWalletService.isSyncedWithinTolerance()) {
|
||||
new Popup().information(Res.get("popup.warning.walletNotSynced")).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue