Skip to content

Commit

Permalink
Merge pull request #3333 from BentoCrypto/develop
Browse files Browse the repository at this point in the history
correcting several spellings
  • Loading branch information
zk19862018 authored Aug 22, 2020
2 parents fa7eec5 + 1bb7c9a commit b00e5f7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void setAccountStateRoot(byte[] root) {
this.block.getBlockHeader().toBuilder().setRawData(blockHeaderRaw)).build();
}

/* only for genisis */
/* only for genesis */
public void setWitness(String witness) {
BlockHeader.raw blockHeaderRaw =
this.block.getBlockHeader().getRawData().toBuilder().setWitnessAddress(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public String toString() {
+ " "
+ messageStatistics.discoverOutNeighbours + "/" + messageStatistics.discoverInFindNode
+ " "
+ ((int) discoverMessageLatency.getAvrg()) + "ms"
+ ((int) discoverMessageLatency.getAvg()) + "ms"
+ ", p2p: " + p2pHandShake + "/" + messageStatistics.p2pInHello + "/"
+ messageStatistics.p2pOutHello + " "
+ ", tron: " + messageStatistics.tronInMessage + "/" + messageStatistics.tronOutMessage
Expand Down Expand Up @@ -205,7 +205,7 @@ public void add(long value) {
count++;
}

public long getAvrg() {
public long getAvg() {
return count == 0 ? 0 : sum / count;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ private int getPacketLossRateScore() {
}

private int getNetLatencyScore() {
return (int) (nodeStatistics.discoverMessageLatency.getAvrg() == 0 ? 0
: min(1000 / nodeStatistics.discoverMessageLatency.getAvrg(), 20));
return (int) (nodeStatistics.discoverMessageLatency.getAvg() == 0 ? 0
: min(1000 / nodeStatistics.discoverMessageLatency.getAvg(), 20));
}

private int getHandshakeScore() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public synchronized void onConnect(Channel peer) {
activePeers.add(peerConnection);
activePeers
.sort(Comparator.comparingDouble(
c -> c.getNodeStatistics().pingMessageLatency.getAvrg()));
c -> c.getNodeStatistics().pingMessageLatency.getAvg()));
peerConnection.onConnect();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public String log() {

getNodeStatistics().pingMessageLatency.getCount(),
getNodeStatistics().pingMessageLatency.getMax(),
getNodeStatistics().pingMessageLatency.getAvrg(),
getNodeStatistics().pingMessageLatency.getAvg(),
getNodeStatistics().pingMessageLatency.getMin(),
getNodeStatistics().pingMessageLatency.getLast(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void setConnectInfo(NodeInfo nodeInfo) {
PeerInfo peerInfo = new PeerInfo();
peerInfo.setHeadBlockWeBothHave(peerConnection.getBlockBothHave().getString());
peerInfo.setActive(peerConnection.isActive());
peerInfo.setAvgLatency(peerConnection.getNodeStatistics().pingMessageLatency.getAvrg());
peerInfo.setAvgLatency(peerConnection.getNodeStatistics().pingMessageLatency.getAvg());
peerInfo.setBlockInPorcSize(peerConnection.getSyncBlockInProcess().size());
peerInfo.setConnectTime(peerConnection.getStartTime());
peerInfo.setDisconnectTimes(peerConnection.getNodeStatistics().getDisconnectTimes());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testNode() throws NoSuchFieldException, IllegalAccessException {
this.nodeStatistics.resetTcpFlow();
this.nodeStatistics.discoverMessageLatency.add(10);
this.nodeStatistics.discoverMessageLatency.add(20);
long avg = this.nodeStatistics.discoverMessageLatency.getAvrg();
long avg = this.nodeStatistics.discoverMessageLatency.getAvg();
Assert.assertEquals(15, avg);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public void testSolidityGrpcCall() {
DynamicProperties dynamicProperties = databaseGrpcClient.getDynamicProperties();
Assert.assertNotNull(dynamicProperties);

Block genisisBlock = databaseGrpcClient.getBlock(0);
Assert.assertNotNull(genisisBlock);
Assert.assertFalse(genisisBlock.getTransactionsList().isEmpty());
Block genesisBlock = databaseGrpcClient.getBlock(0);
Assert.assertNotNull(genesisBlock);
Assert.assertFalse(genesisBlock.getTransactionsList().isEmpty());
}

}

0 comments on commit b00e5f7

Please sign in to comment.