Search in sources :

Example 1 with ParentBlockHeaderValidator

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

the class ChainConfiguration method createPreUnityParentBlockHeaderValidator.

public ParentBlockHeaderValidator createPreUnityParentBlockHeaderValidator() {
    List<DependentBlockHeaderRule> rules = Arrays.asList(new BlockNumberRule(), new TimeStampRule(), new EnergyLimitRule(getConstants().getEnergyDivisorLimitLong(), getConstants().getEnergyLowerBoundLong()));
    Map<Seal, List<DependentBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_WORK, rules);
    unityRules.put(Seal.PROOF_OF_STAKE, rules);
    return new ParentBlockHeaderValidator(unityRules);
}
Also used : 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)

Example 2 with ParentBlockHeaderValidator

use of org.aion.zero.impl.valid.ParentBlockHeaderValidator 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)2 List (java.util.List)2 Seal (org.aion.zero.impl.types.BlockHeader.Seal)2 BlockNumberRule (org.aion.zero.impl.valid.BlockNumberRule)2 DependentBlockHeaderRule (org.aion.zero.impl.valid.DependentBlockHeaderRule)2 EnergyLimitRule (org.aion.zero.impl.valid.EnergyLimitRule)2 GrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GrandParentBlockHeaderValidator)2 GreatGrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator)2 ParentBlockHeaderValidator (org.aion.zero.impl.valid.ParentBlockHeaderValidator)2 StakingBlockTimeStampRule (org.aion.zero.impl.valid.StakingBlockTimeStampRule)2 TimeStampRule (org.aion.zero.impl.valid.TimeStampRule)2 ParentOppositeTypeRule (org.aion.zero.impl.valid.ParentOppositeTypeRule)1