mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-17 00:07:49 +00:00
initialize persisted trades when all services initialized
This commit is contained in:
parent
11f1d75f27
commit
b9524bd19e
1 changed files with 10 additions and 12 deletions
|
@ -67,7 +67,6 @@ import haveno.core.user.User;
|
||||||
import haveno.core.util.Validator;
|
import haveno.core.util.Validator;
|
||||||
import haveno.core.xmr.model.XmrAddressEntry;
|
import haveno.core.xmr.model.XmrAddressEntry;
|
||||||
import haveno.core.xmr.wallet.XmrWalletService;
|
import haveno.core.xmr.wallet.XmrWalletService;
|
||||||
import haveno.network.p2p.BootstrapListener;
|
|
||||||
import haveno.network.p2p.DecryptedDirectMessageListener;
|
import haveno.network.p2p.DecryptedDirectMessageListener;
|
||||||
import haveno.network.p2p.DecryptedMessageWithPubKey;
|
import haveno.network.p2p.DecryptedMessageWithPubKey;
|
||||||
import haveno.network.p2p.NodeAddress;
|
import haveno.network.p2p.NodeAddress;
|
||||||
|
@ -282,16 +281,9 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
if (p2PService.isBootstrapped()) {
|
|
||||||
new Thread(() -> initPersistedTrades()).start(); // initialize trades off main thread
|
// initialize trades off main thread
|
||||||
} else {
|
new Thread(() -> initPersistedTrades()).start();
|
||||||
p2PService.addP2PServiceListener(new BootstrapListener() {
|
|
||||||
@Override
|
|
||||||
public void onUpdatedDataReceived() {
|
|
||||||
initPersistedTrades();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getObservableList().addListener((ListChangeListener<Trade>) change -> onTradesChanged());
|
getObservableList().addListener((ListChangeListener<Trade>) change -> onTradesChanged());
|
||||||
onTradesChanged();
|
onTradesChanged();
|
||||||
|
@ -324,7 +316,12 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||||
log.warn("Error closing trade subprocess. Was Haveno stopped manually with ctrl+c?");
|
log.warn("Error closing trade subprocess. Was Haveno stopped manually with ctrl+c?");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
HavenoUtils.executeTasks(tasks);
|
try {
|
||||||
|
HavenoUtils.executeTasks(tasks);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Error shutting down trades: {}", e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void thawUnreservedOutputs() {
|
private void thawUnreservedOutputs() {
|
||||||
|
@ -390,6 +387,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
log.info("Initializing persisted trades");
|
||||||
HavenoUtils.executeTasks(tasks, threadPoolSize);
|
HavenoUtils.executeTasks(tasks, threadPoolSize);
|
||||||
|
|
||||||
// reset any available address entries
|
// reset any available address entries
|
||||||
|
|
Loading…
Reference in a new issue