Search in sources :

Example 91 with BlockGenerator

use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.

the class BlockTest method sealedBlockSetExtraData.

@Test
public void sealedBlockSetExtraData() {
    Block block = new BlockGenerator().createBlock(10, 0);
    block.seal();
    try {
        block.setExtraData(new byte[32]);
        Assert.fail();
    } catch (SealedBlockException ex) {
        Assert.assertEquals("Sealed block: trying to alter extra data", ex.getMessage());
    }
}
Also used : BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) Test(org.junit.Test)

Example 92 with BlockGenerator

use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.

the class BlockTest method sealedBlockHeaderSetTransactionsRoot.

@Test
public void sealedBlockHeaderSetTransactionsRoot() {
    Block block = new BlockGenerator().createBlock(10, 0);
    block.seal();
    try {
        block.getHeader().setTransactionsRoot(new byte[32]);
        Assert.fail();
    } catch (SealedBlockHeaderException ex) {
        Assert.assertEquals("Sealed block header: trying to alter transactions root", ex.getMessage());
    }
}
Also used : BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) Test(org.junit.Test)

Example 93 with BlockGenerator

use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.

the class BlockTest method sealedBlockHeaderSetLogsBloom.

@Test
public void sealedBlockHeaderSetLogsBloom() {
    Block block = new BlockGenerator().createBlock(10, 0);
    block.seal();
    try {
        block.getHeader().setLogsBloom(new byte[32]);
        Assert.fail();
    } catch (SealedBlockHeaderException ex) {
        Assert.assertEquals("Sealed block header: trying to alter logs bloom", ex.getMessage());
    }
}
Also used : BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) Test(org.junit.Test)

Example 94 with BlockGenerator

use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.

the class BlockTest method sealedBlockHeaderSetStateRoot.

@Test
public void sealedBlockHeaderSetStateRoot() {
    Block block = new BlockGenerator().createBlock(10, 0);
    block.seal();
    try {
        block.getHeader().setStateRoot(new byte[32]);
        Assert.fail();
    } catch (SealedBlockHeaderException ex) {
        Assert.assertEquals("Sealed block header: trying to alter state root", ex.getMessage());
    }
}
Also used : BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) Test(org.junit.Test)

Example 95 with BlockGenerator

use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.

the class BlockTest method sealedBlockHeaderSetBitcoinMergedMiningCoinbaseTransaction.

@Test
public void sealedBlockHeaderSetBitcoinMergedMiningCoinbaseTransaction() {
    Block block = new BlockGenerator().createBlock(10, 0);
    block.seal();
    try {
        block.getHeader().setBitcoinMergedMiningCoinbaseTransaction(new byte[32]);
        Assert.fail();
    } catch (SealedBlockHeaderException ex) {
        Assert.assertEquals("Sealed block header: trying to alter bitcoin merged mining coinbase transaction", ex.getMessage());
    }
}
Also used : BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) Test(org.junit.Test)

Aggregations

BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)250 Test (org.junit.Test)237 Block (org.ethereum.core.Block)104 ArrayList (java.util.ArrayList)39 Blockchain (org.ethereum.core.Blockchain)38 SyncConfiguration (co.rsk.net.sync.SyncConfiguration)36 RskSystemProperties (co.rsk.config.RskSystemProperties)35 SimpleBlock (co.rsk.peg.simples.SimpleBlock)34 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)33 IndexedBlockStore (org.ethereum.db.IndexedBlockStore)31 HashMapDB (org.ethereum.datasource.HashMapDB)22 BlockBuilder (co.rsk.test.builders.BlockBuilder)17 Keccak256 (co.rsk.crypto.Keccak256)15 ProofOfWorkRule (co.rsk.validators.ProofOfWorkRule)15 BlockStore (org.ethereum.db.BlockStore)15 World (co.rsk.test.World)14 RepositoryImpl (co.rsk.db.RepositoryImpl)13 BlockChainBuilder (co.rsk.test.builders.BlockChainBuilder)13 Ignore (org.junit.Ignore)12 co.rsk.bitcoinj.core (co.rsk.bitcoinj.core)10