Search in sources :

Example 1 with ParentOppositeTypeRule

use of org.aion.zero.impl.valid.ParentOppositeTypeRule in project aion by aionnetwork.

the class ChainConfiguration method createUnityParentBlockHeaderValidator.

public ParentBlockHeaderValidator createUnityParentBlockHeaderValidator() {
    List<DependentBlockHeaderRule> PoWrules = Arrays.asList(new BlockNumberRule(), new ParentOppositeTypeRule(), new TimeStampRule(), new EnergyLimitRule(getConstants().getEnergyDivisorLimitLong(), getConstants().getEnergyLowerBoundLong()));
    List<DependentBlockHeaderRule> PoSrules = Arrays.asList(new BlockNumberRule(), new ParentOppositeTypeRule(), new StakingBlockTimeStampRule(), new TimeStampRule(), new EnergyLimitRule(getConstants().getEnergyDivisorLimitLong(), getConstants().getEnergyLowerBoundLong()));
    Map<Seal, List<DependentBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_WORK, PoWrules);
    unityRules.put(Seal.PROOF_OF_STAKE, PoSrules);
    return new ParentBlockHeaderValidator(unityRules);
}
Also used : ParentOppositeTypeRule(org.aion.zero.impl.valid.ParentOppositeTypeRule) StakingBlockTimeStampRule(org.aion.zero.impl.valid.StakingBlockTimeStampRule) DependentBlockHeaderRule(org.aion.zero.impl.valid.DependentBlockHeaderRule) StakingBlockTimeStampRule(org.aion.zero.impl.valid.StakingBlockTimeStampRule) TimeStampRule(org.aion.zero.impl.valid.TimeStampRule) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) EnumMap(java.util.EnumMap) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) ParentBlockHeaderValidator(org.aion.zero.impl.valid.ParentBlockHeaderValidator) GrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GrandParentBlockHeaderValidator) BlockNumberRule(org.aion.zero.impl.valid.BlockNumberRule) EnergyLimitRule(org.aion.zero.impl.valid.EnergyLimitRule)

Aggregations

EnumMap (java.util.EnumMap)1 List (java.util.List)1 Seal (org.aion.zero.impl.types.BlockHeader.Seal)1 BlockNumberRule (org.aion.zero.impl.valid.BlockNumberRule)1 DependentBlockHeaderRule (org.aion.zero.impl.valid.DependentBlockHeaderRule)1 EnergyLimitRule (org.aion.zero.impl.valid.EnergyLimitRule)1 GrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GrandParentBlockHeaderValidator)1 GreatGrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator)1 ParentBlockHeaderValidator (org.aion.zero.impl.valid.ParentBlockHeaderValidator)1 ParentOppositeTypeRule (org.aion.zero.impl.valid.ParentOppositeTypeRule)1 StakingBlockTimeStampRule (org.aion.zero.impl.valid.StakingBlockTimeStampRule)1 TimeStampRule (org.aion.zero.impl.valid.TimeStampRule)1