use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class RskCustomCacheTest method getElement.
@Test
public void getElement() {
RskCustomCache cache = new RskCustomCache(TIME_TO_LIVE);
BlockHeader header1 = Mockito.mock(BlockHeader.class);
cache.put(KEY, header1);
Assert.assertNotNull(cache.get(KEY));
Assert.assertNull(cache.get(OTHER_KEY));
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class RskCustomCacheTest method addElement.
@Test
public void addElement() {
RskCustomCache cache = new RskCustomCache(TIME_TO_LIVE);
BlockHeader header1 = Mockito.mock(BlockHeader.class);
cache.put(KEY, header1);
Assert.assertNotNull(cache.get(KEY));
Assert.assertEquals(header1, cache.get(KEY));
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class BlockTxsValidationRuleTest method setup.
@Before
public void setup() {
parent = mock(Block.class);
BlockHeader parentHeader = mock(BlockHeader.class);
when(parent.getHeader()).thenReturn(parentHeader);
RepositoryLocator repositoryLocator = mock(RepositoryLocator.class);
repositorySnapshot = mock(RepositorySnapshot.class);
when(repositoryLocator.snapshotAt(parentHeader)).thenReturn(repositorySnapshot);
rule = new BlockTxsValidationRule(repositoryLocator);
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class ParentGasLimitRuleTest method parentGasLimitGreaterThanGasLimit.
// pass rule
@Test
public void parentGasLimitGreaterThanGasLimit() {
BlockHeader header = getHeader(10000);
BlockHeader parent = getHeader(10001);
assertTrue(rule.validate(header, parent));
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class ParentGasLimitRuleTest method getHeader.
// Used also by GasLimitCalculatorTest
public static BlockHeader getHeader(BlockFactory blockFactory, long gasLimitValue) {
byte[] gasLimit = DataWord.valueOf(gasLimitValue).getData();
BlockHeader header = blockFactory.getBlockHeaderBuilder().setCoinbase(TestUtils.randomAddress()).setDifficulty(BlockDifficulty.ZERO).setGasLimit(gasLimit).build();
return header;
}
Aggregations