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 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 ParentGasLimitRuleTest method getHeader.
// Used also by GasLimitCalculatorTest
public static BlockHeader getHeader(long gasLimitValue) {
byte[] gasLimit = new DataWord(gasLimitValue).getData();
BlockHeader header = new BlockHeader(null, null, RskAddress.nullAddress().getBytes(), null, BlockDifficulty.ZERO.getBytes(), 0, gasLimit, 0, 0, null, null, 0);
return header;
}
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 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));
}
Aggregations