Commit b776e839 authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] Fix NullPointerException when computing buid on peer.stats with an empty peerCountByBuid map

parent 27a96d62
Pipeline #4314 passed with stage
in 30 seconds
......@@ -270,7 +270,7 @@ public class NetworkServiceImpl extends BaseRemoteServiceImpl implements Network
boolean isMainConsensus = buid.equals(mainBuid);
stats.setMainConsensus(isMainConsensus);
boolean isForkConsensus = !isMainConsensus && peerCountByBuid.get(buid) > 1;
boolean isForkConsensus = !isMainConsensus && peerCountByBuid.containsKey(buid) && peerCountByBuid.get(buid) > 1;
stats.setForkConsensus(isForkConsensus);
stats.setConsensusPct(isMainConsensus || isForkConsensus ? buidsPct.get(buid) : 0d);
......
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