mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
resume syncing wallet after applying proxy uri change
This commit is contained in:
parent
280ed484e7
commit
606b2cef23
@ -69,6 +69,7 @@ import monero.common.MoneroError;
|
|||||||
import monero.common.MoneroRpcConnection;
|
import monero.common.MoneroRpcConnection;
|
||||||
import monero.common.TaskLooper;
|
import monero.common.TaskLooper;
|
||||||
import monero.daemon.MoneroDaemon;
|
import monero.daemon.MoneroDaemon;
|
||||||
|
import monero.daemon.model.MoneroDaemonInfo;
|
||||||
import monero.daemon.model.MoneroKeyImage;
|
import monero.daemon.model.MoneroKeyImage;
|
||||||
import monero.daemon.model.MoneroTx;
|
import monero.daemon.model.MoneroTx;
|
||||||
import monero.wallet.MoneroWallet;
|
import monero.wallet.MoneroWallet;
|
||||||
@ -810,6 +811,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
stopPolling();
|
stopPolling();
|
||||||
xmrWalletService.closeWallet(wallet, true);
|
xmrWalletService.closeWallet(wallet, true);
|
||||||
wallet = null;
|
wallet = null;
|
||||||
|
walletRefreshPeriod = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1787,7 +1789,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
if (this.walletRefreshPeriod != null && this.walletRefreshPeriod == walletRefreshPeriod) return;
|
if (this.walletRefreshPeriod != null && this.walletRefreshPeriod == walletRefreshPeriod) return;
|
||||||
this.walletRefreshPeriod = walletRefreshPeriod;
|
this.walletRefreshPeriod = walletRefreshPeriod;
|
||||||
if (getWallet() != null) {
|
if (getWallet() != null) {
|
||||||
log.info("Setting wallet refresh rate for {} {} to {}", getClass().getSimpleName(), getId(), walletRefreshPeriod);
|
log.info("Setting wallet refresh rate for {} {} to {}", getClass().getSimpleName(), getId(), getWalletRefreshPeriod());
|
||||||
getWallet().startSyncing(getWalletRefreshPeriod()); // TODO (monero-project): wallet rpc waits until last sync period finishes before starting new sync period
|
getWallet().startSyncing(getWalletRefreshPeriod()); // TODO (monero-project): wallet rpc waits until last sync period finishes before starting new sync period
|
||||||
}
|
}
|
||||||
if (isPolling()) {
|
if (isPolling()) {
|
||||||
@ -1822,8 +1824,15 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void pollWallet() {
|
private void pollWallet() {
|
||||||
|
MoneroWallet wallet = getWallet();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// check if wallet's height is less than daemon's
|
||||||
|
MoneroDaemonInfo lastInfo = xmrWalletService.getConnectionsService().getLastInfo();
|
||||||
|
if (lastInfo != null && wallet.getHeight() < lastInfo.getHeight() - 2) {
|
||||||
|
log.warn("Daemon's height is more than 2 blocks ahead of wallet's height; daemon height={}, wallet height={}, tradeId={}", lastInfo.getHeight(), wallet.getHeight(), getShortId());
|
||||||
|
}
|
||||||
|
|
||||||
// skip if either deposit tx id is unknown
|
// skip if either deposit tx id is unknown
|
||||||
if (processModel.getMaker().getDepositTxHash() == null || processModel.getTaker().getDepositTxHash() == null) return;
|
if (processModel.getMaker().getDepositTxHash() == null || processModel.getTaker().getDepositTxHash() == null) return;
|
||||||
|
|
||||||
@ -1831,7 +1840,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
if (isPayoutUnlocked()) return;
|
if (isPayoutUnlocked()) return;
|
||||||
|
|
||||||
// rescan spent outputs to detect payout tx after deposits unlocked
|
// rescan spent outputs to detect payout tx after deposits unlocked
|
||||||
if (isDepositsUnlocked() && !isPayoutPublished()) getWallet().rescanSpent();
|
if (isDepositsUnlocked() && !isPayoutPublished()) wallet.rescanSpent();
|
||||||
|
|
||||||
// get txs from trade wallet
|
// get txs from trade wallet
|
||||||
boolean payoutExpected = isPaymentReceived() || processModel.getPaymentReceivedMessage() != null || disputeState.ordinal() > DisputeState.ARBITRATOR_SENT_DISPUTE_CLOSED_MSG.ordinal() || processModel.getDisputeClosedMessage() != null;
|
boolean payoutExpected = isPaymentReceived() || processModel.getPaymentReceivedMessage() != null || disputeState.ordinal() > DisputeState.ARBITRATOR_SENT_DISPUTE_CLOSED_MSG.ordinal() || processModel.getDisputeClosedMessage() != null;
|
||||||
@ -1898,7 +1907,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (!isShutDownStarted && getWallet() != null && isWalletConnected()) {
|
if (!isShutDownStarted && wallet != null && isWalletConnected()) {
|
||||||
log.warn("Error polling trade wallet for {} {}: {}. Monerod={}", getClass().getSimpleName(), getId(), e.getMessage(), getXmrWalletService().getConnectionsService().getConnection());
|
log.warn("Error polling trade wallet for {} {}: {}. Monerod={}", getClass().getSimpleName(), getId(), e.getMessage(), getXmrWalletService().getConnectionsService().getConnection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user