mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-22 06:38:55 -04:00
Fix bug when trader is offline and use password protection signing payout tx fails
This commit is contained in:
parent
81fcc82972
commit
c021ea8ea2
6 changed files with 44 additions and 77 deletions
|
@ -95,7 +95,6 @@ public class ArbitratorManager {
|
|||
private final ArbitratorService arbitratorService;
|
||||
private final User user;
|
||||
private final ObservableMap<NodeAddress, Arbitrator> arbitratorsObservableMap = FXCollections.observableHashMap();
|
||||
private BootstrapListener bootstrapListener;
|
||||
private Timer republishArbitratorTimer, retryRepublishArbitratorTimer;
|
||||
|
||||
|
||||
|
@ -125,9 +124,6 @@ public class ArbitratorManager {
|
|||
public void shutDown() {
|
||||
stopRepublishArbitratorTimer();
|
||||
stopRetryRepublishArbitratorTimer();
|
||||
if (bootstrapListener != null)
|
||||
arbitratorService.getP2PService().removeP2PServiceListener(bootstrapListener);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,22 +134,15 @@ public class ArbitratorManager {
|
|||
public void onAllServicesInitialized() {
|
||||
if (user.getRegisteredArbitrator() != null) {
|
||||
P2PService p2PService = arbitratorService.getP2PService();
|
||||
if (!p2PService.isBootstrapped()) {
|
||||
bootstrapListener = new BootstrapListener() {
|
||||
if (p2PService.isBootstrapped())
|
||||
republishArbitrator();
|
||||
else
|
||||
p2PService.addP2PServiceListener(new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
ArbitratorManager.this.onBootstrapComplete();
|
||||
republishArbitrator();
|
||||
}
|
||||
};
|
||||
|
||||
if (p2PService.isBootstrapped())
|
||||
onBootstrapComplete();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
|
||||
} else {
|
||||
republishArbitrator();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
republishArbitratorTimer = UserThread.runPeriodically(this::republishArbitrator, REPUBLISH_MILLIS, TimeUnit.MILLISECONDS);
|
||||
|
@ -247,15 +236,6 @@ public class ArbitratorManager {
|
|||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void onBootstrapComplete() {
|
||||
if (bootstrapListener != null) {
|
||||
arbitratorService.getP2PService().removeP2PServiceListener(bootstrapListener);
|
||||
bootstrapListener = null;
|
||||
}
|
||||
|
||||
republishArbitrator();
|
||||
}
|
||||
|
||||
private void republishArbitrator() {
|
||||
Arbitrator registeredArbitrator = user.getRegisteredArbitrator();
|
||||
if (registeredArbitrator != null) {
|
||||
|
|
|
@ -70,7 +70,6 @@ public class DisputeManager {
|
|||
private final DisputeList<Dispute> disputes;
|
||||
transient private final ObservableList<Dispute> disputesObservableList;
|
||||
private final String disputeInfo;
|
||||
private final BootstrapListener bootstrapListener;
|
||||
private final CopyOnWriteArraySet<DecryptedMsgWithPubKey> decryptedMailboxMessageWithPubKeys = new CopyOnWriteArraySet<>();
|
||||
private final CopyOnWriteArraySet<DecryptedMsgWithPubKey> decryptedDirectMessageWithPubKeys = new CopyOnWriteArraySet<>();
|
||||
|
||||
|
@ -118,17 +117,23 @@ public class DisputeManager {
|
|||
if (p2PService.isBootstrapped())
|
||||
applyMessages();
|
||||
});
|
||||
}
|
||||
|
||||
bootstrapListener = new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
applyMessages();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
if (p2PService.isBootstrapped())
|
||||
applyMessages();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
p2PService.addP2PServiceListener(new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
applyMessages();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void applyMessages() {
|
||||
|
@ -148,17 +153,6 @@ public class DisputeManager {
|
|||
}
|
||||
});
|
||||
decryptedMailboxMessageWithPubKeys.clear();
|
||||
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
}
|
||||
|
||||
private void dispatchMessage(DisputeMessage message) {
|
||||
|
|
|
@ -81,7 +81,6 @@ public class TradeManager {
|
|||
private final Storage<TradableList<Trade>> tradableListStorage;
|
||||
private final TradableList<Trade> trades;
|
||||
private final BooleanProperty pendingTradesInitialized = new SimpleBooleanProperty();
|
||||
private final BootstrapListener bootstrapListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -147,19 +146,20 @@ public class TradeManager {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bootstrapListener = new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
// Get called after onMailboxMessageAdded from initial data request
|
||||
// The mailbox message will be removed inside the tasks after they are processed successfully
|
||||
initPendingTrades();
|
||||
}
|
||||
};
|
||||
public void onAllServicesInitialized() {
|
||||
if (p2PService.isBootstrapped())
|
||||
initPendingTrades();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
p2PService.addP2PServiceListener(new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
// Get called after onMailboxMessageAdded from initial data request
|
||||
// The mailbox message will be removed inside the tasks after they are processed successfully
|
||||
initPendingTrades();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,8 +169,6 @@ public class TradeManager {
|
|||
|
||||
private void initPendingTrades() {
|
||||
Log.traceCall();
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
|
||||
//List<Trade> failedTrades = new ArrayList<>();
|
||||
for (Trade trade : trades) {
|
||||
|
|
|
@ -81,7 +81,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
private final Storage<TradableList<OpenOffer>> openOffersStorage;
|
||||
private boolean stopped;
|
||||
private Timer periodicRepublishOffersTimer, periodicRefreshOffersTimer, retryRepublishOffersTimer;
|
||||
private BootstrapListener bootstrapListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -114,19 +113,17 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
}
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
bootstrapListener = new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
OpenOfferManager.this.onBootstrapComplete();
|
||||
}
|
||||
};
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
p2PService.addDecryptedDirectMessageListener(this);
|
||||
|
||||
if (p2PService.isBootstrapped())
|
||||
onBootstrapComplete();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
p2PService.addP2PServiceListener(new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
OpenOfferManager.this.onBootstrapComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
|
@ -138,8 +135,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
stopped = true;
|
||||
p2PService.getPeerManager().removeListener(this);
|
||||
p2PService.removeDecryptedDirectMessageListener(this);
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
|
||||
stopPeriodicRefreshOffersTimer();
|
||||
stopPeriodicRepublishOffersTimer();
|
||||
|
@ -187,9 +182,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onBootstrapComplete() {
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
|
||||
stopped = false;
|
||||
|
||||
// Republish means we send the complete offer object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue