use of co.rsk.validators.DummyBlockValidationRule in project rskj by rsksmart.
the class NodeMessageHandlerTest method processGetBlockHeaderMessageUsingEmptyStore.
@Test
public void processGetBlockHeaderMessageUsingEmptyStore() throws UnknownHostException {
final Block block = new BlockGenerator().getBlock(3);
final World world = new World();
final Blockchain blockchain = world.getBlockChain();
final BlockStore store = new BlockStore();
BlockNodeInformation nodeInformation = new BlockNodeInformation();
SyncConfiguration syncConfiguration = SyncConfiguration.IMMEDIATE_FOR_TESTING;
BlockSyncService blockSyncService = new BlockSyncService(config, store, blockchain, nodeInformation, syncConfiguration);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService, syncConfiguration);
final NodeMessageHandler handler = new NodeMessageHandler(config, bp, null, null, null, null, null, new DummyBlockValidationRule());
final SimpleMessageChannel sender = new SimpleMessageChannel();
handler.processMessage(sender, new GetBlockHeadersMessage(block.getHash().getBytes(), 1));
Assert.assertTrue(sender.getMessages().isEmpty());
}
use of co.rsk.validators.DummyBlockValidationRule in project rskj by rsksmart.
the class NodeMessageHandlerUtil method createHandler.
public static NodeMessageHandler createHandler(BlockValidationRule validationRule) {
final World world = new World();
final BlockStore store = new BlockStore();
final Blockchain blockchain = world.getBlockChain();
BlockNodeInformation nodeInformation = new BlockNodeInformation();
SyncConfiguration syncConfiguration = SyncConfiguration.IMMEDIATE_FOR_TESTING;
BlockSyncService blockSyncService = new BlockSyncService(config, store, blockchain, nodeInformation, syncConfiguration);
SyncProcessor syncProcessor = new SyncProcessor(config, blockchain, blockSyncService, RskMockFactory.getPeerScoringManager(), RskMockFactory.getChannelManager(), syncConfiguration, new DummyBlockValidationRule(), DIFFICULTY_CALCULATOR);
NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService, syncConfiguration);
return new NodeMessageHandler(config, processor, syncProcessor, new SimpleChannelManager(), null, null, RskMockFactory.getPeerScoringManager(), validationRule);
}
use of co.rsk.validators.DummyBlockValidationRule in project rskj by rsksmart.
the class SimpleAsyncNode method createNode.
public static SimpleAsyncNode createNode(Blockchain blockchain, SyncConfiguration syncConfiguration) {
final BlockStore store = new BlockStore();
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(config, store, blockchain, nodeInformation, syncConfiguration);
NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService, syncConfiguration);
DummyBlockValidationRule blockValidationRule = new DummyBlockValidationRule();
PeerScoringManager peerScoringManager = RskMockFactory.getPeerScoringManager();
SimpleChannelManager channelManager = new SimpleChannelManager();
SyncProcessor syncProcessor = new SyncProcessor(config, blockchain, blockSyncService, peerScoringManager, channelManager, syncConfiguration, blockValidationRule, new DifficultyCalculator(config));
NodeMessageHandler handler = new NodeMessageHandler(config, processor, syncProcessor, channelManager, null, null, peerScoringManager, blockValidationRule);
return new SimpleAsyncNode(handler, syncProcessor, channelManager);
}
Aggregations