[bisq-network/bisq] Refactor capabilities (#2552)

Florian Reimair notifications at github.com
Mon Mar 18 18:47:17 UTC 2019


freimair commented on this pull request.



>                          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())

This, again, is a bug which has been introduced with the previous refactoring.

The goal is to find "cached" capabilities for a given peer. By filtering for no capabilities (`!peer...hasCapabilities`), we only get a list of peers which have an empty set of capabilities - which does not help in achieving the goal. Again, this bug does not break anything as active peers (with time) report their capabilities and hence, the bug does not show itself easily.

This change, again, restores the intended functionality by filtering for peers with a non-empty (`!peer...isEmpty`) set of capabilities.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/2552#discussion_r266590094
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190318/f88793d6/attachment.html>


More information about the bisq-github mailing list