Search in sources :

Example 1 with GreatGrandParentBlockHeaderValidator

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

the class ChainConfiguration method createUnityGreatGrandParentHeaderValidator.

public GreatGrandParentBlockHeaderValidator createUnityGreatGrandParentHeaderValidator() {
    List<GreatGrandParentDependantBlockHeaderRule> powRules = Collections.singletonList(new UnityDifficultyRule(this));
    List<GreatGrandParentDependantBlockHeaderRule> posRules = Arrays.asList(new UnityDifficultyRule(this), new StakingSeedRule());
    Map<Seal, List<GreatGrandParentDependantBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_WORK, powRules);
    unityRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new GreatGrandParentBlockHeaderValidator(unityRules);
}
Also used : UnityDifficultyRule(org.aion.zero.impl.valid.UnityDifficultyRule) StakingSeedRule(org.aion.zero.impl.valid.StakingSeedRule) GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) EnumMap(java.util.EnumMap)

Example 2 with GreatGrandParentBlockHeaderValidator

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

the class ChainConfiguration method createNonceSeedValidator.

public GreatGrandParentBlockHeaderValidator createNonceSeedValidator() {
    List<GreatGrandParentDependantBlockHeaderRule> posRules = Collections.singletonList(new StakingSeedCreationRule());
    Map<Seal, List<GreatGrandParentDependantBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new GreatGrandParentBlockHeaderValidator(unityRules);
}
Also used : GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) StakingSeedCreationRule(org.aion.zero.impl.valid.StakingSeedCreationRule) EnumMap(java.util.EnumMap)

Example 3 with GreatGrandParentBlockHeaderValidator

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

the class ChainConfiguration method createNonceSeedDifficultyValidator.

public GreatGrandParentBlockHeaderValidator createNonceSeedDifficultyValidator() {
    List<GreatGrandParentDependantBlockHeaderRule> posRules = Collections.singletonList(new UnityDifficultyRule(this));
    Map<Seal, List<GreatGrandParentDependantBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new GreatGrandParentBlockHeaderValidator(unityRules);
}
Also used : UnityDifficultyRule(org.aion.zero.impl.valid.UnityDifficultyRule) GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) EnumMap(java.util.EnumMap)

Aggregations

EnumMap (java.util.EnumMap)3 List (java.util.List)3 Seal (org.aion.zero.impl.types.BlockHeader.Seal)3 GreatGrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator)3 GreatGrandParentDependantBlockHeaderRule (org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule)3 UnityDifficultyRule (org.aion.zero.impl.valid.UnityDifficultyRule)2 StakingSeedCreationRule (org.aion.zero.impl.valid.StakingSeedCreationRule)1 StakingSeedRule (org.aion.zero.impl.valid.StakingSeedRule)1