use lock for importing multisig hex

This commit is contained in:
woodser 2024-08-04 13:42:19 -04:00
parent ca7d596175
commit d9a3feba8d

View file

@ -143,7 +143,8 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
private static final long DELETE_AFTER_NUM_BLOCKS = 2; // if deposit requested but not published private static final long DELETE_AFTER_NUM_BLOCKS = 2; // if deposit requested but not published
private static final long EXTENDED_RPC_TIMEOUT = 600000; // 10 minutes private static final long EXTENDED_RPC_TIMEOUT = 600000; // 10 minutes
private static final long DELETE_AFTER_MS = TradeProtocol.TRADE_STEP_TIMEOUT_SECONDS; private static final long DELETE_AFTER_MS = TradeProtocol.TRADE_STEP_TIMEOUT_SECONDS;
private final Object pollLock = new Object(); protected final Object pollLock = new Object();
protected static final Object importMultisigLock = new Object();
private boolean pollInProgress; private boolean pollInProgress;
private boolean restartInProgress; private boolean restartInProgress;
private Subscription protocolErrorStateSubscription; private Subscription protocolErrorStateSubscription;
@ -1066,6 +1067,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
public void importMultisigHex() { public void importMultisigHex() {
synchronized (walletLock) { synchronized (walletLock) {
synchronized (HavenoUtils.getDaemonLock()) { // lock on daemon because import calls full refresh synchronized (HavenoUtils.getDaemonLock()) { // lock on daemon because import calls full refresh
synchronized (importMultisigLock) {
for (int i = 0; i < TradeProtocol.MAX_ATTEMPTS; i++) { for (int i = 0; i < TradeProtocol.MAX_ATTEMPTS; i++) {
MoneroRpcConnection sourceConnection = xmrConnectionService.getConnection(); MoneroRpcConnection sourceConnection = xmrConnectionService.getConnection();
try { try {
@ -1083,6 +1085,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
} }
} }
} }
}
private void doImportMultisigHex() { private void doImportMultisigHex() {