mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-22 06:38:55 -04:00
P2P network improvements
This commit is contained in:
parent
97629cb0cd
commit
7c3732c0e5
36 changed files with 831 additions and 416 deletions
|
@ -121,7 +121,7 @@ public class ArbitratorManager {
|
|||
if (user.getRegisteredArbitrator() != null) {
|
||||
|
||||
P2PService p2PService = arbitratorService.getP2PService();
|
||||
if (!p2PService.getFirstPeerAuthenticated()) {
|
||||
if (!p2PService.isAuthenticated()) {
|
||||
firstPeerAuthenticatedListener = new FirstPeerAuthenticatedListener() {
|
||||
@Override
|
||||
public void onFirstPeerAuthenticated() {
|
||||
|
|
|
@ -106,12 +106,12 @@ public class DisputeManager {
|
|||
|
||||
p2PService.addDecryptedMailListener((decryptedMessageWithPubKey, senderAddress) -> {
|
||||
decryptedMailMessageWithPubKeys.add(decryptedMessageWithPubKey);
|
||||
if (p2PService.getFirstPeerAuthenticated())
|
||||
if (p2PService.isAuthenticated())
|
||||
applyMessages();
|
||||
});
|
||||
p2PService.addDecryptedMailboxListener((decryptedMessageWithPubKey, senderAddress) -> {
|
||||
decryptedMailboxMessageWithPubKeys.add(decryptedMessageWithPubKey);
|
||||
if (p2PService.getFirstPeerAuthenticated())
|
||||
if (p2PService.isAuthenticated())
|
||||
applyMessages();
|
||||
});
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.Service;
|
||||
import io.bitsquare.app.Log;
|
||||
import io.bitsquare.btc.listeners.AddressConfidenceListener;
|
||||
import io.bitsquare.btc.listeners.BalanceListener;
|
||||
import io.bitsquare.btc.listeners.TxConfidenceListener;
|
||||
|
@ -537,14 +536,12 @@ public class WalletService {
|
|||
|
||||
@Override
|
||||
protected void progress(double percentage, int blocksLeft, Date date) {
|
||||
Log.traceCall("percentage=" + percentage);
|
||||
super.progress(percentage, blocksLeft, date);
|
||||
UserThread.execute(() -> this.percentage.set(percentage / 100d));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doneDownload() {
|
||||
Log.traceCall();
|
||||
super.doneDownload();
|
||||
UserThread.execute(() -> this.percentage.set(1d));
|
||||
}
|
||||
|
|
|
@ -125,9 +125,9 @@ public class OpenOfferManager {
|
|||
// setupAnStartRePublishThread will re-publish at method call
|
||||
|
||||
// Before the TTL is reached we re-publish our offers
|
||||
// If offer removal at shutdown fails we don't want to have long term dangling dead offers, so we set TTL quite short and use re-publish as
|
||||
// strategy. Offerers need to be online anyway.
|
||||
if (!p2PService.getFirstPeerAuthenticated()) {
|
||||
// If offer removal at shutdown fails we don't want to have long term dangling dead offers, so we set
|
||||
// TTL quite short and use re-publish as strategy. Offerers need to be online anyway.
|
||||
if (!p2PService.isAuthenticated()) {
|
||||
firstPeerAuthenticatedListener = new FirstPeerAuthenticatedListener() {
|
||||
@Override
|
||||
public void onFirstPeerAuthenticated() {
|
||||
|
|
|
@ -88,7 +88,6 @@ public class Preferences implements Serializable {
|
|||
private boolean useAnimations = true;
|
||||
private boolean useEffects = true;
|
||||
private boolean displaySecurityDepositInfo = true;
|
||||
private boolean useUPnP = true;
|
||||
private ArrayList<TradeCurrency> tradeCurrencies;
|
||||
private BlockChainExplorer blockChainExplorerMainNet;
|
||||
private BlockChainExplorer blockChainExplorerTestNet;
|
||||
|
@ -123,7 +122,6 @@ public class Preferences implements Serializable {
|
|||
setBtcDenomination(persisted.btcDenomination);
|
||||
setUseAnimations(persisted.useAnimations);
|
||||
setUseEffects(persisted.useEffects);
|
||||
setUseUPnP(persisted.useUPnP);
|
||||
setTradeCurrencies(persisted.tradeCurrencies);
|
||||
tradeCurrencies = new ArrayList<>(tradeCurrenciesAsObservable);
|
||||
displaySecurityDepositInfo = persisted.getDisplaySecurityDepositInfo();
|
||||
|
@ -172,15 +170,15 @@ public class Preferences implements Serializable {
|
|||
// Use that to guarantee update of the serializable field and to make a storage update in case of a change
|
||||
btcDenominationProperty.addListener((ov) -> {
|
||||
btcDenomination = btcDenominationProperty.get();
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
});
|
||||
useAnimationsProperty.addListener((ov) -> {
|
||||
useAnimations = useAnimationsProperty.get();
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
});
|
||||
useEffectsProperty.addListener((ov) -> {
|
||||
useEffects = useEffectsProperty.get();
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
});
|
||||
tradeCurrenciesAsObservable.addListener((Observable ov) -> {
|
||||
tradeCurrencies.clear();
|
||||
|
@ -191,7 +189,7 @@ public class Preferences implements Serializable {
|
|||
|
||||
public void dontShowAgain(String id) {
|
||||
showAgainMap.put(id, false);
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,12 +211,7 @@ public class Preferences implements Serializable {
|
|||
|
||||
public void setDisplaySecurityDepositInfo(boolean displaySecurityDepositInfo) {
|
||||
this.displaySecurityDepositInfo = displaySecurityDepositInfo;
|
||||
storage.queueUpForSave();
|
||||
}
|
||||
|
||||
public void setUseUPnP(boolean useUPnP) {
|
||||
this.useUPnP = useUPnP;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
public void setBitcoinNetwork(BitcoinNetwork bitcoinNetwork) {
|
||||
|
@ -235,12 +228,12 @@ public class Preferences implements Serializable {
|
|||
|
||||
private void setBlockChainExplorerTestNet(BlockChainExplorer blockChainExplorerTestNet) {
|
||||
this.blockChainExplorerTestNet = blockChainExplorerTestNet;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
private void setBlockChainExplorerMainNet(BlockChainExplorer blockChainExplorerMainNet) {
|
||||
this.blockChainExplorerMainNet = blockChainExplorerMainNet;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
public void setBlockChainExplorer(BlockChainExplorer blockChainExplorer) {
|
||||
|
@ -252,12 +245,12 @@ public class Preferences implements Serializable {
|
|||
|
||||
public void setShowPlaceOfferConfirmation(boolean showPlaceOfferConfirmation) {
|
||||
this.showPlaceOfferConfirmation = showPlaceOfferConfirmation;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
public void setShowTakeOfferConfirmation(boolean showTakeOfferConfirmation) {
|
||||
this.showTakeOfferConfirmation = showTakeOfferConfirmation;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
public void setTacAccepted(boolean tacAccepted) {
|
||||
|
@ -310,10 +303,6 @@ public class Preferences implements Serializable {
|
|||
return useEffectsProperty;
|
||||
}
|
||||
|
||||
public boolean getUseUPnP() {
|
||||
return useUPnP;
|
||||
}
|
||||
|
||||
public BitcoinNetwork getBitcoinNetwork() {
|
||||
return bitcoinNetwork;
|
||||
}
|
||||
|
@ -379,7 +368,7 @@ public class Preferences implements Serializable {
|
|||
// if we add new and those are not in our stored map we display by default the new popup
|
||||
if (!getShowAgainMap().containsKey(key)) {
|
||||
showAgainMap.put(key, true);
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
return showAgainMap.get(key);
|
||||
|
|
|
@ -318,7 +318,7 @@ public class User implements Serializable {
|
|||
|
||||
public void setDevelopersAlert(Alert developersAlert) {
|
||||
this.developersAlert = developersAlert;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
public Alert getDevelopersAlert() {
|
||||
|
@ -327,7 +327,7 @@ public class User implements Serializable {
|
|||
|
||||
public void setDisplayedAlert(Alert displayedAlert) {
|
||||
this.displayedAlert = displayedAlert;
|
||||
storage.queueUpForSave();
|
||||
storage.queueUpForSave(2000);
|
||||
}
|
||||
|
||||
public Alert getDisplayedAlert() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue