mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Renamed hasCapabilities to isEmpty
This commit is contained in:
parent
ede3a3c721
commit
afc241c52a
@ -83,8 +83,8 @@ public class Capabilities {
|
||||
return containsAll(capabilities.capabilities);
|
||||
}
|
||||
|
||||
public boolean hasCapabilities() {
|
||||
return !capabilities.isEmpty();
|
||||
public boolean isEmpty() {
|
||||
return capabilities.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
@ -619,7 +619,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
// it from old versions, so we filter those.
|
||||
Optional<Peer> optionalPeer = allPeers.stream()
|
||||
.filter(peer -> peer.getNodeAddress().equals(peersNodeAddress))
|
||||
.filter(peer -> peer.getCapabilities().hasCapabilities())
|
||||
.filter(peer -> !peer.getCapabilities().isEmpty())
|
||||
.findAny();
|
||||
if (optionalPeer.isPresent()) {
|
||||
boolean result = optionalPeer.get().getCapabilities().containsAll(((CapabilityRequiringPayload) message).getRequiredCapabilities());
|
||||
|
@ -176,7 +176,7 @@ public class PeerManager implements ConnectionListener, PersistedDataHost {
|
||||
PeerList persistedPeerList = storage.initAndGetPersistedWithFileName("PeerList", 1000);
|
||||
if (persistedPeerList != null) {
|
||||
long peersWithNoCapabilitiesSet = persistedPeerList.getList().stream()
|
||||
.filter(e -> e.getCapabilities().hasCapabilities())
|
||||
.filter(e -> e.getCapabilities().isEmpty())
|
||||
.mapToInt(e -> 1)
|
||||
.count();
|
||||
if (peersWithNoCapabilitiesSet > 100) {
|
||||
@ -664,11 +664,11 @@ public class PeerManager implements ConnectionListener, PersistedDataHost {
|
||||
// If we have a new connection the supportedCapabilities is empty.
|
||||
// We lookup if we have already stored the supportedCapabilities at the persisted or reported peers
|
||||
// and if so we use that.
|
||||
if (!supportedCapabilities.hasCapabilities()) {
|
||||
if (supportedCapabilities.isEmpty()) {
|
||||
Set<Peer> allPeers = new HashSet<>(getPersistedPeers());
|
||||
allPeers.addAll(getReportedPeers());
|
||||
Optional<Peer> ourPeer = allPeers.stream().filter(peer -> peer.getNodeAddress().equals(connection.getPeersNodeAddressOptional().get()))
|
||||
.filter(peer -> !peer.getCapabilities().hasCapabilities())
|
||||
.filter(peer -> !peer.getCapabilities().isEmpty())
|
||||
.findAny();
|
||||
if(ourPeer.isPresent())
|
||||
supportedCapabilities = new Capabilities(ourPeer.get().getCapabilities());
|
||||
|
@ -97,7 +97,7 @@ public final class Peer implements HasCapabilities, NetworkPayload, PersistableP
|
||||
|
||||
@Override
|
||||
public void onChanged(Capabilities supportedCapabilities) {
|
||||
if (supportedCapabilities.hasCapabilities())
|
||||
if (!supportedCapabilities.isEmpty())
|
||||
capabilities.set(supportedCapabilities);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user