mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-10 05:03:35 +01:00
sync on wallet lock before checking if wallet is behind
This commit is contained in:
parent
3dfaa2fc52
commit
443c2f4cdb
@ -2412,6 +2412,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
||||
private void syncWallet(boolean pollWallet) {
|
||||
MoneroRpcConnection sourceConnection = xmrConnectionService.getConnection();
|
||||
try {
|
||||
synchronized (walletLock) {
|
||||
if (getWallet() == null) throw new RuntimeException("Cannot sync trade wallet because it doesn't exist for " + getClass().getSimpleName() + ", " + getId());
|
||||
if (getWallet().getDaemonConnection() == null) throw new RuntimeException("Cannot sync trade wallet because it's not connected to a Monero daemon for " + getClass().getSimpleName() + ", " + getId());
|
||||
if (isWalletBehind()) {
|
||||
@ -2420,6 +2421,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
||||
syncWalletIfBehind();
|
||||
log.info("Done syncing wallet for {} {} in {} ms", getClass().getSimpleName(), getShortId(), System.currentTimeMillis() - startTime);
|
||||
}
|
||||
}
|
||||
|
||||
// apply tor after wallet synced depending on configuration
|
||||
if (!wasWalletSynced) {
|
||||
@ -2627,8 +2629,8 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
||||
}
|
||||
|
||||
private void syncWalletIfBehind() {
|
||||
if (isWalletBehind()) {
|
||||
synchronized (walletLock) {
|
||||
if (isWalletBehind()) {
|
||||
syncWithProgress();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user