Allow Attached rules to be flagged 'light' (#580)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
tmohay 6 years ago committed by GitHub
parent 7e373ccc97
commit cbd2442510
  1. 4
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/AttachedBlockHeaderValidationRule.java
  2. 2
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/BlockHeaderValidator.java

@ -26,4 +26,8 @@ public interface AttachedBlockHeaderValidationRule<C> {
* @return {@code true} if valid; otherwise {@code false}
*/
boolean validate(BlockHeader header, BlockHeader parent, ProtocolContext<C> protocolContext);
default boolean includeInLightValidation() {
return true;
}
}

@ -120,7 +120,7 @@ public class BlockHeaderValidator<C> {
private final List<Rule<C>> rules = new ArrayList<>();
public Builder<C> addRule(final AttachedBlockHeaderValidationRule<C> rule) {
this.rules.add(new Rule<>(false, rule, true));
this.rules.add(new Rule<>(false, rule, rule.includeInLightValidation()));
return this;
}

Loading…
Cancel
Save