Search in sources :

Example 26 with NodeID

use of co.rsk.net.NodeID in project rskj by rsksmart.

the class PeerScoringManagerTest method invalidTransactionGivesNoBadReputationToNode.

@Test
public void invalidTransactionGivesNoBadReputationToNode() throws UnknownHostException {
    NodeID id = generateNodeID();
    PeerScoringManager manager = createPeerScoringManager();
    manager.recordEvent(id, null, EventType.INVALID_TRANSACTION);
    Assert.assertTrue(manager.hasGoodReputation(id));
    Assert.assertEquals(0, manager.getPeerScoring(id).getTimeLostGoodReputation());
}
Also used : NodeID(co.rsk.net.NodeID) Test(org.junit.Test)

Example 27 with NodeID

use of co.rsk.net.NodeID in project rskj by rsksmart.

the class PeerScoringManagerTest method invalidBlockGivesBadReputationToNode.

@Test
public void invalidBlockGivesBadReputationToNode() throws UnknownHostException {
    NodeID id = generateNodeID();
    PeerScoringManager manager = createPeerScoringManager();
    manager.recordEvent(id, null, EventType.INVALID_BLOCK);
    Assert.assertFalse(manager.hasGoodReputation(id));
    Assert.assertNotEquals(0, manager.getPeerScoring(id).getTimeLostGoodReputation());
}
Also used : NodeID(co.rsk.net.NodeID) Test(org.junit.Test)

Aggregations

NodeID (co.rsk.net.NodeID)27 Test (org.junit.Test)19 InetAddress (java.net.InetAddress)8 Block (org.ethereum.core.Block)4 RskSystemProperties (co.rsk.config.RskSystemProperties)3 Metrics (co.rsk.net.Metrics)3 Status (co.rsk.net.Status)3 RskMessage (co.rsk.net.eth.RskMessage)3 co.rsk.net.messages (co.rsk.net.messages)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 java.util (java.util)3 ArrayList (java.util.ArrayList)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 Executors (java.util.concurrent.Executors)3 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)3 TimeUnit (java.util.concurrent.TimeUnit)3 Collectors (java.util.stream.Collectors)3 Nonnull (javax.annotation.Nonnull)3 Nullable (javax.annotation.Nullable)3 CollectionUtils (org.apache.commons.collections4.CollectionUtils)3