mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
add HavenoUtils.isSeedNode()
This commit is contained in:
parent
1a981f28df
commit
df27902577
@ -519,7 +519,7 @@ public final class XmrConnectionService {
|
||||
private void maybeStartLocalNode() {
|
||||
|
||||
// skip if seed node
|
||||
if (HavenoUtils.havenoSetup == null) return;
|
||||
if (HavenoUtils.isSeedNode()) return;
|
||||
|
||||
// start local node if offline and used as last connection
|
||||
if (connectionManager.getConnection() != null && xmrLocalNode.equalsUri(connectionManager.getConnection().getUri()) && !xmrLocalNode.isDetected() && !xmrLocalNode.shouldBeIgnored()) {
|
||||
|
@ -121,21 +121,21 @@ public class OfferBookService {
|
||||
|
||||
@Override
|
||||
public void onRemoved(Collection<ProtectedStorageEntry> protectedStorageEntries) {
|
||||
protectedStorageEntries.forEach(protectedStorageEntry -> {
|
||||
synchronized (offerBookChangedListeners) {
|
||||
offerBookChangedListeners.forEach(listener -> {
|
||||
if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) {
|
||||
OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload();
|
||||
maybeInitializeKeyImagePoller();
|
||||
keyImagePoller.removeKeyImages(offerPayload.getReserveTxKeyImages());
|
||||
Offer offer = new Offer(offerPayload);
|
||||
offer.setPriceFeedService(priceFeedService);
|
||||
setReservedFundsSpent(offer);
|
||||
listener.onRemoved(offer);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
protectedStorageEntries.forEach(protectedStorageEntry -> {
|
||||
synchronized (offerBookChangedListeners) {
|
||||
offerBookChangedListeners.forEach(listener -> {
|
||||
if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) {
|
||||
OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload();
|
||||
maybeInitializeKeyImagePoller();
|
||||
keyImagePoller.removeKeyImages(offerPayload.getReserveTxKeyImages());
|
||||
Offer offer = new Offer(offerPayload);
|
||||
offer.setPriceFeedService(priceFeedService);
|
||||
setReservedFundsSpent(offer);
|
||||
listener.onRemoved(offer);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -74,6 +74,10 @@ public class HavenoUtils {
|
||||
public static ArbitrationManager arbitrationManager;
|
||||
public static HavenoSetup havenoSetup;
|
||||
|
||||
public static boolean isSeedNode() {
|
||||
return havenoSetup == null;
|
||||
}
|
||||
|
||||
// ----------------------- CONVERSION UTILS -------------------------------
|
||||
|
||||
public static BigInteger coinToAtomicUnits(Coin coin) {
|
||||
|
@ -428,7 +428,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
}
|
||||
|
||||
// process after all wallets initialized
|
||||
if (HavenoUtils.havenoSetup != null) { // null for seednode
|
||||
if (!HavenoUtils.isSeedNode()) {
|
||||
|
||||
// maybe remove trades on error
|
||||
for (Trade trade : tradesToMaybeRemoveOnError) {
|
||||
|
Loading…
Reference in New Issue
Block a user