Search in sources :

Example 11 with SimpleBlockProcessor

use of co.rsk.net.simples.SimpleBlockProcessor in project rskj by rsksmart.

the class Web3ImplTest method eth_syncing_returnFalseWhenNotSyncing.

@Test
public void eth_syncing_returnFalseWhenNotSyncing() {
    World world = new World();
    SimpleBlockProcessor nodeProcessor = new SimpleBlockProcessor();
    nodeProcessor.lastKnownBlockNumber = 0;
    Web3Impl web3 = createWeb3(world, nodeProcessor, null);
    Object result = web3.eth_syncing();
    Assert.assertTrue("Node is not syncing, must return false", !(boolean) result);
}
Also used : SimpleBlockProcessor(co.rsk.net.simples.SimpleBlockProcessor) World(co.rsk.test.World) Test(org.junit.Test)

Example 12 with SimpleBlockProcessor

use of co.rsk.net.simples.SimpleBlockProcessor in project rskj by rsksmart.

the class Web3ImplTest method eth_syncing_returnSyncingResultWhenSyncing.

@Test
public void eth_syncing_returnSyncingResultWhenSyncing() {
    World world = new World();
    SimpleBlockProcessor nodeProcessor = new SimpleBlockProcessor();
    nodeProcessor.lastKnownBlockNumber = 5;
    Web3Impl web3 = createWeb3(world, nodeProcessor, null);
    Object result = web3.eth_syncing();
    Assert.assertTrue("Node is syncing, must return sync manager", result instanceof Web3.SyncingResult);
    Assert.assertTrue("Highest block is 5", ((Web3.SyncingResult) result).highestBlock.compareTo("0x5") == 0);
    Assert.assertTrue("Simple blockchain starts from genesis block", ((Web3.SyncingResult) result).currentBlock.compareTo("0x0") == 0);
}
Also used : SimpleBlockProcessor(co.rsk.net.simples.SimpleBlockProcessor) World(co.rsk.test.World) Test(org.junit.Test)

Aggregations

SimpleBlockProcessor (co.rsk.net.simples.SimpleBlockProcessor)12 Test (org.junit.Test)11 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)10 ProofOfWorkRule (co.rsk.validators.ProofOfWorkRule)7 PeerScoring (co.rsk.scoring.PeerScoring)6 PeerScoringManager (co.rsk.scoring.PeerScoringManager)6 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)4 DummyBlockValidationRule (co.rsk.validators.DummyBlockValidationRule)3 World (co.rsk.test.World)2 Ignore (org.junit.Ignore)1