use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class ParentGasLimitRuleTest method parentGasLimitOfBy1Tests.
// no pass rule
@Test
public void parentGasLimitOfBy1Tests() {
BlockHeader parent = getHeader(2049);
BlockHeader headerGGood = getHeader(2051);
BlockHeader headerGBad = getHeader(2052);
BlockHeader headerLGood = getHeader(2047);
BlockHeader headerLBad = getHeader(2046);
assertTrue(rule.validate(headerGGood, parent));
assertTrue(rule.validate(headerLGood, parent));
assertFalse(rule.validate(headerGBad, parent));
assertFalse(rule.validate(headerLBad, parent));
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class ParentGasLimitRuleTest method parentGasLimitLessThanGasLimit.
// pass rule
@Test
public void parentGasLimitLessThanGasLimit() {
BlockHeader header = getHeader(10000);
BlockHeader parent = getHeader(9999);
assertTrue(rule.validate(header, parent));
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class DifficultyRuleTest method getHeader.
private BlockHeader getHeader(long difficultyValue) {
byte[] difficulty = DataWord.valueOf(difficultyValue).getData();
BlockHeader header = blockFactory.getBlockHeaderBuilder().setCoinbase(TestUtils.randomAddress()).setDifficultyFromBytes(difficulty).build();
return header;
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class DifficultyRuleTest method parentDifficultyEqualHeaderDifficulty.
// no pass rule
@Test
public void parentDifficultyEqualHeaderDifficulty() {
BlockHeader header = getHeader(10000);
BlockHeader parent = getHeader(10000);
assertFalse(rule.validate(header, parent));
}
use of org.ethereum.core.BlockHeader in project rskj by rsksmart.
the class ParentNumberRuleTest method parentNumberEqualBlockNumberMinusOne.
// pass rule
@Test
public void parentNumberEqualBlockNumberMinusOne() {
BlockHeader header = getHeader(10000);
BlockHeader parent = getHeader(9999);
assertTrue(rule.validate(header, parent));
}
Aggregations