Commit 6ae5df32 authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] Fix NullPointerException whencomputing buid on peer.stats without block number

parent 4d06518c
Pipeline #4308 passed with stage
in 30 seconds
......@@ -236,10 +236,12 @@ public class NetworkServiceImpl extends BaseRemoteServiceImpl implements Network
}
public List<Peer> fillPeerStatsConsensus(final List<Peer> peers) {
if (CollectionUtils.isEmpty(peers)) return peers;
final Map<String,Long> peerCountByBuid = peers.stream()
.filter(peer -> peer.getStats().isReacheable() && Peers.hasBmaEndpoint(peer))
.filter(peer -> peer.getStats() != null && peer.getStats().isReacheable() && Peers.hasBmaEndpoint(peer))
.map(Peers::buid)
.filter(b -> b != null)
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
// Compute main consensus buid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment