mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-06 21:13:59 -04:00
add lock to submit tx to pool for verification and sync on shut down
This commit is contained in:
parent
5720ee74b0
commit
580e5b672c
@ -68,7 +68,6 @@ import java.util.stream.Stream;
|
||||
import javafx.beans.property.LongProperty;
|
||||
import javafx.beans.property.ReadOnlyDoubleProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import lombok.Getter;
|
||||
import monero.common.MoneroError;
|
||||
import monero.common.MoneroRpcConnection;
|
||||
import monero.common.MoneroRpcError;
|
||||
@ -145,8 +144,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||
private TradeManager tradeManager;
|
||||
private ExecutorService syncWalletThreadPool = Executors.newFixedThreadPool(10); // TODO: adjust based on connection type
|
||||
|
||||
@Getter
|
||||
public final Object lock = new Object();
|
||||
private final Object lock = new Object();
|
||||
private TaskLooper pollLooper;
|
||||
private boolean pollInProgress;
|
||||
private Long pollPeriodMs;
|
||||
@ -740,7 +738,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||
MoneroDaemonRpc daemon = getDaemon();
|
||||
MoneroWallet wallet = getWallet();
|
||||
MoneroTx tx = null;
|
||||
synchronized (daemon) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
|
||||
// verify tx not submitted to pool
|
||||
@ -926,7 +924,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||
}
|
||||
|
||||
// shut down threads
|
||||
synchronized (getLock()) {
|
||||
synchronized (lock) {
|
||||
List<Runnable> shutDownThreads = new ArrayList<>();
|
||||
shutDownThreads.add(() -> ThreadUtils.shutDown(THREAD_ID));
|
||||
ThreadUtils.awaitTasks(shutDownThreads);
|
||||
|
Loading…
x
Reference in New Issue
Block a user