mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04: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;
|
||||
synchronized (walletLock) {
|
||||
if (wallet != null) {
|
||||
saveWallet();
|
||||
xmrWalletService.saveWallet(wallet, false); // skip backup
|
||||
stopWallet();
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,9 @@ public class BuyerPreparePaymentSentMessage extends TradeTask {
|
||||
MoneroTxWallet payoutTx = trade.createPayoutTx();
|
||||
trade.setPayoutTx(payoutTx);
|
||||
trade.setPayoutTxHex(payoutTx.getTxSet().getMultisigTxHex());
|
||||
|
||||
// save wallet off thread
|
||||
new Thread(() -> trade.saveWallet()).start();
|
||||
}
|
||||
|
||||
complete();
|
||||
|
@ -69,6 +69,9 @@ public class ProcessDepositsConfirmedMessage extends TradeTask {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// save wallet off thread
|
||||
new Thread(() -> trade.saveWallet()).start();
|
||||
|
||||
// persist and complete
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
complete();
|
||||
|
@ -110,7 +110,7 @@ public class ProcessInitMultisigRequest extends TradeTask {
|
||||
log.info("Importing exchanged multisig hex for trade {}", trade.getId());
|
||||
MoneroMultisigInitResult result = multisigWallet.exchangeMultisigKeys(Arrays.asList(peers[0].getExchangedMultisigHex(), peers[1].getExchangedMultisigHex()), xmrWalletService.getWalletPassword());
|
||||
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.updateWalletRefreshPeriod(); // starts syncing
|
||||
}
|
||||
|
@ -69,6 +69,9 @@ public class ProcessPaymentSentMessage extends TradeTask {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// save wallet off thread
|
||||
new Thread(() -> trade.saveWallet()).start();
|
||||
|
||||
// update state
|
||||
trade.advanceState(Trade.State.BUYER_SENT_PAYMENT_SENT_MSG);
|
||||
trade.requestPersistence();
|
||||
|
Loading…
Reference in New Issue
Block a user