mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
skip wallet polls if daemon not synced (#1080)
This commit is contained in:
parent
c3b93b6e75
commit
1debdde33e
@ -2404,8 +2404,10 @@ public abstract class Trade implements Tradable, Model {
|
||||
// skip if deposit txs unknown or not requested
|
||||
if (processModel.getMaker().getDepositTxHash() == null || processModel.getTaker().getDepositTxHash() == null || !isDepositRequested()) return;
|
||||
|
||||
// skip if daemon not synced
|
||||
if (xmrConnectionService.getTargetHeight() == null || !xmrConnectionService.isSyncedWithinTolerance()) return;
|
||||
|
||||
// sync if wallet too far behind daemon
|
||||
if (xmrConnectionService.getTargetHeight() == null) return;
|
||||
if (walletHeight.get() < xmrConnectionService.getTargetHeight() - SYNC_EVERY_NUM_BLOCKS) syncWallet(false);
|
||||
|
||||
// update deposit txs
|
||||
|
@ -1803,12 +1803,18 @@ public class XmrWalletService {
|
||||
pollInProgress = true;
|
||||
try {
|
||||
|
||||
// switch to best connection if daemon is too far behind
|
||||
// skip if daemon not synced
|
||||
MoneroDaemonInfo lastInfo = xmrConnectionService.getLastInfo();
|
||||
if (lastInfo == null) {
|
||||
log.warn("Last daemon info is null");
|
||||
return;
|
||||
}
|
||||
if (!xmrConnectionService.isSyncedWithinTolerance()) {
|
||||
log.warn("Monero daemon is not synced within tolerance, height={}, targetHeight={}", xmrConnectionService.chainHeightProperty().get(), xmrConnectionService.getTargetHeight());
|
||||
return;
|
||||
}
|
||||
|
||||
// switch to best connection if wallet is too far behind
|
||||
if (wasWalletSynced && walletHeight.get() < xmrConnectionService.getTargetHeight() - NUM_BLOCKS_BEHIND_TOLERANCE && !Config.baseCurrencyNetwork().isTestnet()) {
|
||||
log.warn("Updating connection because main wallet is {} blocks behind monerod, wallet height={}, monerod height={}", xmrConnectionService.getTargetHeight() - walletHeight.get(), walletHeight.get(), lastInfo.getHeight());
|
||||
xmrConnectionService.switchToBestConnection();
|
||||
|
Loading…
Reference in New Issue
Block a user