Search in sources :

Example 1 with UnityDifficultyRule

use of org.aion.zero.impl.valid.UnityDifficultyRule 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 UnityDifficultyRule

use of org.aion.zero.impl.valid.UnityDifficultyRule 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)2 List (java.util.List)2 Seal (org.aion.zero.impl.types.BlockHeader.Seal)2 GreatGrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator)2 GreatGrandParentDependantBlockHeaderRule (org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule)2 UnityDifficultyRule (org.aion.zero.impl.valid.UnityDifficultyRule)2 StakingSeedRule (org.aion.zero.impl.valid.StakingSeedRule)1