use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.
the class BlockTest method sealedBlockHasSealesBlockHeader.
@Test
public void sealedBlockHasSealesBlockHeader() {
Block block = new BlockGenerator().createBlock(10, 0);
block.seal();
Assert.assertTrue(block.getHeader().isSealed());
}
use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.
the class BlockTest method sealedBlockHeaderSetTimestamp.
@Test
public void sealedBlockHeaderSetTimestamp() {
Block block = new BlockGenerator().createBlock(10, 0);
block.seal();
try {
block.getHeader().setTimestamp(10);
Assert.fail();
} catch (SealedBlockHeaderException ex) {
Assert.assertEquals("Sealed block header: trying to alter timestamp", ex.getMessage());
}
}
use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.
the class BlockTest method sealedBlockHeaderSetGasUsed.
@Test
public void sealedBlockHeaderSetGasUsed() {
Block block = new BlockGenerator().createBlock(10, 0);
block.seal();
try {
block.getHeader().setGasUsed(10);
Assert.fail();
} catch (SealedBlockHeaderException ex) {
Assert.assertEquals("Sealed block header: trying to alter gas used", ex.getMessage());
}
}
use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.
the class BlockTest method sealedBlockHeaderSetBitcoinMergedMiningHeader.
@Test
public void sealedBlockHeaderSetBitcoinMergedMiningHeader() {
Block block = new BlockGenerator().createBlock(10, 0);
block.seal();
try {
block.getHeader().setBitcoinMergedMiningHeader(new byte[32]);
Assert.fail();
} catch (SealedBlockHeaderException ex) {
Assert.assertEquals("Sealed block header: trying to alter bitcoin merged mining header", ex.getMessage());
}
}
use of co.rsk.blockchain.utils.BlockGenerator in project rskj by rsksmart.
the class BlockTest method checkTxTrieShouldBeDifferentForDifferentBlock.
@Test
public void checkTxTrieShouldBeDifferentForDifferentBlock() {
BlockGenerator blockGenerator = new BlockGenerator();
Block block1 = blockGenerator.createBlock(10, 1);
Block block2 = blockGenerator.createBlock(10, 2);
String trieHash1 = Hex.toHexString(block1.getTxTrieRoot());
String trieHash2 = Hex.toHexString(block2.getTxTrieRoot());
Assert.assertNotEquals(trieHash1, trieHash2);
}
Aggregations