use of org.hyperledger.besu.config.JsonBftConfigOptions in project besu by hyperledger.
the class IbftForksSchedulesFactoryTest method createsScheduleWithForkThatOverridesGenesisValues.
@Test
public void createsScheduleWithForkThatOverridesGenesisValues() {
final MutableBftConfigOptions configOptions = new MutableBftConfigOptions(JsonBftConfigOptions.DEFAULT);
final ObjectNode fork = JsonUtil.objectNodeFromMap(Map.of(BftFork.FORK_BLOCK_KEY, 1, BftFork.BLOCK_PERIOD_SECONDS_KEY, 10, BftFork.BLOCK_REWARD_KEY, "5"));
final ForksSchedule<BftConfigOptions> forksSchedule = IbftForksSchedulesFactory.create(createGenesisConfig(configOptions, fork));
assertThat(forksSchedule.getFork(0)).usingRecursiveComparison().isEqualTo(new ForkSpec<>(0, configOptions));
final Map<String, Object> forkOptions = new HashMap<>(configOptions.asMap());
forkOptions.put(BftFork.BLOCK_PERIOD_SECONDS_KEY, 10);
forkOptions.put(BftFork.BLOCK_REWARD_KEY, "5");
final BftConfigOptions expectedForkConfig = new MutableBftConfigOptions(new JsonBftConfigOptions(JsonUtil.objectNodeFromMap(forkOptions)));
final ForkSpec<BftConfigOptions> expectedFork = new ForkSpec<>(1, expectedForkConfig);
assertThat(forksSchedule.getFork(1)).usingRecursiveComparison().isEqualTo(expectedFork);
assertThat(forksSchedule.getFork(2)).usingRecursiveComparison().isEqualTo(expectedFork);
}
Aggregations