Search in sources :

Example 6 with TxHandler

use of co.rsk.net.handler.TxHandler in project rskj by rsksmart.

the class NodeMessageHandlerTest method processNewBlockHashesMessageDoesNothingBecauseNodeIsSyncing.

@Test
public void processNewBlockHashesMessageDoesNothingBecauseNodeIsSyncing() {
    TxHandler txHandler = mock(TxHandler.class);
    BlockProcessor blockProcessor = mock(BlockProcessor.class);
    Mockito.when(blockProcessor.hasBetterBlockToSync()).thenReturn(true);
    final NodeMessageHandler handler = new NodeMessageHandler(config, blockProcessor, null, null, null, txHandler, null, new ProofOfWorkRule(config).setFallbackMiningEnabled(false));
    Message message = mock(Message.class);
    Mockito.when(message.getMessageType()).thenReturn(MessageType.NEW_BLOCK_HASHES);
    handler.processMessage(null, message);
    verify(blockProcessor, never()).processNewBlockHashesMessage(any(), any());
}
Also used : TxHandler(co.rsk.net.handler.TxHandler) SimpleBlockProcessor(co.rsk.net.simples.SimpleBlockProcessor) ProofOfWorkRule(co.rsk.validators.ProofOfWorkRule) Test(org.junit.Test)

Aggregations

TxHandler (co.rsk.net.handler.TxHandler)6 SimpleBlockProcessor (co.rsk.net.simples.SimpleBlockProcessor)6 ProofOfWorkRule (co.rsk.validators.ProofOfWorkRule)6 Test (org.junit.Test)6 SimpleChannelManager (org.ethereum.rpc.Simples.SimpleChannelManager)5 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)4 SimpleTransactionPool (co.rsk.net.simples.SimpleTransactionPool)4 PeerScoring (co.rsk.scoring.PeerScoring)3 PeerScoringManager (co.rsk.scoring.PeerScoringManager)3 RepositoryImpl (co.rsk.db.RepositoryImpl)1 TxHandlerImpl (co.rsk.net.handler.TxHandlerImpl)1 World (co.rsk.test.World)1 BigInteger (java.math.BigInteger)1 CompositeEthereumListener (org.ethereum.listener.CompositeEthereumListener)1 ChannelManager (org.ethereum.net.server.ChannelManager)1