mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-02 11:46:11 -04:00
Require password at startup, heck for open offers at emptying wallet, add check for isBootstrapped,
This commit is contained in:
parent
5af70848a7
commit
0ebf3f6b36
12 changed files with 74 additions and 74 deletions
|
@ -145,8 +145,12 @@ public class ArbitratorManager {
|
|||
ArbitratorManager.this.onBootstrapComplete();
|
||||
}
|
||||
};
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
|
||||
if (p2PService.isBootstrapped())
|
||||
onBootstrapComplete();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
|
||||
} else {
|
||||
republishArbitrator();
|
||||
}
|
||||
|
|
|
@ -125,7 +125,10 @@ public class DisputeManager {
|
|||
applyMessages();
|
||||
}
|
||||
};
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
if (p2PService.isBootstrapped())
|
||||
applyMessages();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
}
|
||||
|
||||
private void applyMessages() {
|
||||
|
@ -146,7 +149,8 @@ public class DisputeManager {
|
|||
});
|
||||
decryptedMailboxMessageWithPubKeys.clear();
|
||||
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -151,13 +151,15 @@ public class TradeManager {
|
|||
bootstrapListener = new BootstrapListener() {
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
Log.traceCall("onNetworkReady");
|
||||
// Get called after onMailboxMessageAdded from initial data request
|
||||
// The mailbox message will be removed inside the tasks after they are processed successfully
|
||||
initPendingTrades();
|
||||
}
|
||||
};
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
if (p2PService.isBootstrapped())
|
||||
initPendingTrades();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +169,8 @@ public class TradeManager {
|
|||
|
||||
private void initPendingTrades() {
|
||||
Log.traceCall();
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
|
||||
//List<Trade> failedTrades = new ArrayList<>();
|
||||
for (Trade trade : trades) {
|
||||
|
|
|
@ -53,6 +53,7 @@ import javax.annotation.Nullable;
|
|||
import javax.inject.Named;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -121,6 +122,11 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
};
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
p2PService.addDecryptedDirectMessageListener(this);
|
||||
|
||||
if (p2PService.isBootstrapped())
|
||||
onBootstrapComplete();
|
||||
else
|
||||
p2PService.addP2PServiceListener(bootstrapListener);
|
||||
}
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
|
@ -151,6 +157,15 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
UserThread.runAfter(completeHandler::run, openOffers.size() * 100 + 200, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void removeAllOpenOffers(@Nullable Runnable completeHandler) {
|
||||
List<OpenOffer> openOffersList = new ArrayList<>(openOffers);
|
||||
openOffersList.forEach(openOffer -> removeOpenOffer(openOffer, () -> {
|
||||
}, errorMessage -> {
|
||||
}));
|
||||
if (completeHandler != null)
|
||||
UserThread.runAfter(completeHandler::run, openOffers.size() * 100 + 200, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DecryptedDirectMessageListener implementation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -172,7 +187,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onBootstrapComplete() {
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
if (bootstrapListener != null)
|
||||
p2PService.removeP2PServiceListener(bootstrapListener);
|
||||
|
||||
stopped = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue