Search in sources :

Example 61 with BlockBuilder

use of co.rsk.test.builders.BlockBuilder in project rskj by rsksmart.

the class BlockBuilderTest method buildBlockWithGenesisAsParent.

@Test
public void buildBlockWithGenesisAsParent() {
    Block genesis = new BlockGenerator().getGenesisBlock();
    BlockBuilder builder = new BlockBuilder();
    Block block = builder.parent(genesis).build();
    Assert.assertNotNull(block);
    Assert.assertEquals(1, block.getNumber());
    // Assert.assertTrue(genesis.getCumulativeDifficulty().compareTo(block.getDifficultyBI()) < 0);
    Assert.assertEquals(genesis.getHash(), block.getParentHash());
}
Also used : Block(org.ethereum.core.Block) BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) BlockBuilder(co.rsk.test.builders.BlockBuilder) Test(org.junit.Test)

Aggregations

BlockBuilder (co.rsk.test.builders.BlockBuilder)61 Test (org.junit.Test)54 World (co.rsk.test.World)36 ArrayList (java.util.ArrayList)27 AccountBuilder (co.rsk.test.builders.AccountBuilder)26 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)17 TransactionBuilder (co.rsk.test.builders.TransactionBuilder)13 TransactionPoolImpl (co.rsk.core.bc.TransactionPoolImpl)12 BlockChainImpl (co.rsk.core.bc.BlockChainImpl)11 SimpleBlock (co.rsk.peg.simples.SimpleBlock)11 Block (org.ethereum.core.Block)11 HashMapDB (org.ethereum.datasource.HashMapDB)9 IndexedBlockStore (org.ethereum.db.IndexedBlockStore)8 SimpleEthereum (org.ethereum.rpc.Simples.SimpleEthereum)8 RemascTransaction (co.rsk.remasc.RemascTransaction)7 BlockChainBuilder (co.rsk.test.builders.BlockChainBuilder)7 TransactionResultDTO (org.ethereum.rpc.dto.TransactionResultDTO)6 BlockHeader (org.ethereum.core.BlockHeader)4 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)3 BlockStore (org.ethereum.db.BlockStore)3