mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +00:00
fixes checking for missing wallet data
This commit is contained in:
parent
09fd8710b1
commit
9b26682646
1 changed files with 12 additions and 4 deletions
|
@ -2578,7 +2578,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
if (isConnectionRefused) forceRestartTradeWallet();
|
||||
else {
|
||||
boolean isWalletConnected = isWalletConnectedToDaemon();
|
||||
if (!isShutDownStarted && wallet != null && isWalletConnected) {
|
||||
if (wallet != null && !isShutDownStarted && isWalletConnected) {
|
||||
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), getXmrWalletService().getConnectionService().getConnection());
|
||||
requestSwitchToNextBestConnection();
|
||||
//e.printStackTrace();
|
||||
|
@ -2622,6 +2622,9 @@ public abstract class Trade implements Tradable, Model {
|
|||
// force restart wallet
|
||||
forceRestartTradeWallet();
|
||||
|
||||
// skip if payout published in the meantime
|
||||
if (isPayoutPublished()) return;
|
||||
|
||||
// rescan blockchain with global daemon lock
|
||||
synchronized (HavenoUtils.getDaemonLock()) {
|
||||
Long timeout = null;
|
||||
|
@ -2651,12 +2654,15 @@ public abstract class Trade implements Tradable, Model {
|
|||
// import multisig hex
|
||||
log.warn("Importing multisig hex to recover wallet data for {} {}", getClass().getSimpleName(), getShortId());
|
||||
importMultisigHex();
|
||||
}
|
||||
}
|
||||
|
||||
// check again after releasing lock
|
||||
// poll wallet
|
||||
doPollWallet();
|
||||
|
||||
// check again if missing data
|
||||
if (isWalletMissingData()) throw new IllegalStateException("Wallet is still missing data after attempting recovery for " + getClass().getSimpleName() + " " + getShortId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isWalletMissingData() {
|
||||
synchronized (walletLock) {
|
||||
|
@ -2670,6 +2676,8 @@ public abstract class Trade implements Tradable, Model {
|
|||
return true;
|
||||
}
|
||||
if (wallet.getBalance().equals(BigInteger.ZERO)) {
|
||||
doPollWallet(); // poll once more to be sure
|
||||
if (isPayoutPublished()) return false; // payout can become published while checking balance
|
||||
log.warn("Wallet balance is zero for {} {}", getClass().getSimpleName(), getId());
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue