mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-11-30 16:36:36 -05:00
improve reliability of requesting persistence and persisting trade state (#1921)
This commit is contained in:
parent
afe4ba3ad8
commit
0c1e4f31af
2 changed files with 15 additions and 11 deletions
|
|
@ -813,12 +813,14 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
while (!isFullyInitialized) HavenoUtils.waitFor(100); // TODO: use proper notification and refactor isInitialized, fullyInitialized, and arbitrator idling
|
||||
}
|
||||
|
||||
// TODO: throw if trade manager is null
|
||||
public void requestPersistence() {
|
||||
if (processModel.getTradeManager() != null) processModel.getTradeManager().requestPersistence();
|
||||
}
|
||||
|
||||
// TODO: throw if trade manager is null
|
||||
public void persistNow(@Nullable Runnable completeHandler) {
|
||||
processModel.getTradeManager().persistNow(completeHandler);
|
||||
if (processModel.getTradeManager() != null) processModel.getTradeManager().persistNow(completeHandler);
|
||||
}
|
||||
|
||||
public TradeProtocol getProtocol() {
|
||||
|
|
@ -1099,7 +1101,6 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
synchronized (HavenoUtils.getWalletFunctionLock()) {
|
||||
MoneroTxWallet tx = wallet.createTx(txConfig);
|
||||
exportMultisigHex();
|
||||
saveWallet();
|
||||
return tx;
|
||||
}
|
||||
}
|
||||
|
|
@ -1108,7 +1109,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
public void exportMultisigHex() {
|
||||
synchronized (walletLock) {
|
||||
getSelf().setUpdatedMultisigHex(wallet.exportMultisigHex());
|
||||
requestPersistence();
|
||||
saveWallet();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1889,7 +1890,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
}
|
||||
|
||||
this.state = state;
|
||||
requestPersistence();
|
||||
persistNow(null);
|
||||
UserThread.execute(() -> {
|
||||
stateProperty.set(state);
|
||||
phaseProperty.set(state.getPhase());
|
||||
|
|
@ -1921,7 +1922,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
}
|
||||
|
||||
this.payoutState = payoutState;
|
||||
requestPersistence();
|
||||
persistNow(null);
|
||||
UserThread.execute(() -> payoutStateProperty.set(payoutState));
|
||||
}
|
||||
|
||||
|
|
@ -1937,6 +1938,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
}
|
||||
|
||||
this.disputeState = disputeState;
|
||||
persistNow(null);
|
||||
UserThread.execute(() -> {
|
||||
disputeStateProperty.set(disputeState);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue