mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-24 23:09:36 -05:00
save and back up trade wallets off thread at key steps
This commit is contained in:
parent
37e812dead
commit
a7ab31d44e
@ -1162,7 +1162,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
isShutDown = true;
|
isShutDown = true;
|
||||||
synchronized (walletLock) {
|
synchronized (walletLock) {
|
||||||
if (wallet != null) {
|
if (wallet != null) {
|
||||||
saveWallet();
|
xmrWalletService.saveWallet(wallet, false); // skip backup
|
||||||
stopWallet();
|
stopWallet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,9 @@ public class BuyerPreparePaymentSentMessage extends TradeTask {
|
|||||||
MoneroTxWallet payoutTx = trade.createPayoutTx();
|
MoneroTxWallet payoutTx = trade.createPayoutTx();
|
||||||
trade.setPayoutTx(payoutTx);
|
trade.setPayoutTx(payoutTx);
|
||||||
trade.setPayoutTxHex(payoutTx.getTxSet().getMultisigTxHex());
|
trade.setPayoutTxHex(payoutTx.getTxSet().getMultisigTxHex());
|
||||||
|
|
||||||
|
// save wallet off thread
|
||||||
|
new Thread(() -> trade.saveWallet()).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
complete();
|
complete();
|
||||||
|
@ -69,6 +69,9 @@ public class ProcessDepositsConfirmedMessage extends TradeTask {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save wallet off thread
|
||||||
|
new Thread(() -> trade.saveWallet()).start();
|
||||||
|
|
||||||
// persist and complete
|
// persist and complete
|
||||||
processModel.getTradeManager().requestPersistence();
|
processModel.getTradeManager().requestPersistence();
|
||||||
complete();
|
complete();
|
||||||
|
@ -110,7 +110,7 @@ public class ProcessInitMultisigRequest extends TradeTask {
|
|||||||
log.info("Importing exchanged multisig hex for trade {}", trade.getId());
|
log.info("Importing exchanged multisig hex for trade {}", trade.getId());
|
||||||
MoneroMultisigInitResult result = multisigWallet.exchangeMultisigKeys(Arrays.asList(peers[0].getExchangedMultisigHex(), peers[1].getExchangedMultisigHex()), xmrWalletService.getWalletPassword());
|
MoneroMultisigInitResult result = multisigWallet.exchangeMultisigKeys(Arrays.asList(peers[0].getExchangedMultisigHex(), peers[1].getExchangedMultisigHex()), xmrWalletService.getWalletPassword());
|
||||||
processModel.setMultisigAddress(result.getAddress());
|
processModel.setMultisigAddress(result.getAddress());
|
||||||
trade.saveWallet(); // save multisig wallet on completion
|
new Thread(() -> trade.saveWallet()).start(); // save multisig wallet off thread on completion
|
||||||
trade.setStateIfValidTransitionTo(Trade.State.MULTISIG_COMPLETED);
|
trade.setStateIfValidTransitionTo(Trade.State.MULTISIG_COMPLETED);
|
||||||
trade.updateWalletRefreshPeriod(); // starts syncing
|
trade.updateWalletRefreshPeriod(); // starts syncing
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,9 @@ public class ProcessPaymentSentMessage extends TradeTask {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save wallet off thread
|
||||||
|
new Thread(() -> trade.saveWallet()).start();
|
||||||
|
|
||||||
// update state
|
// update state
|
||||||
trade.advanceState(Trade.State.BUYER_SENT_PAYMENT_SENT_MSG);
|
trade.advanceState(Trade.State.BUYER_SENT_PAYMENT_SENT_MSG);
|
||||||
trade.requestPersistence();
|
trade.requestPersistence();
|
||||||
|
Loading…
Reference in New Issue
Block a user