diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSchedule.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSchedule.java index 5950d68e55..a5675ef667 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSchedule.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSchedule.java @@ -60,6 +60,10 @@ public class CliqueProtocolSchedule extends MutableProtocolSchedule protocolSchedule.putMilestone(blockNumber, specs.byzantium())); + config + .getConstantinopleBlockNumber() + .ifPresent( + blockNumber -> protocolSchedule.putMilestone(blockNumber, specs.constantinople())); return protocolSchedule; } diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSpecs.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSpecs.java index 662764722c..773a33c88f 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSpecs.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSpecs.java @@ -66,6 +66,10 @@ public class CliqueProtocolSpecs { return applyCliqueSpecificModifications(MainnetProtocolSpecs.byzantiumDefinition(chainId)); } + public ProtocolSpec constantinople() { + return applyCliqueSpecificModifications(MainnetProtocolSpecs.constantinopleDefinition(chainId)); + } + private ProtocolSpec applyCliqueSpecificModifications( final ProtocolSpecBuilder specBuilder) { final EpochManager epochManager = new EpochManager(epochLength); diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MainnetProtocolSpecs.java index 23feee2bab..bedcf75089 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MainnetProtocolSpecs.java @@ -263,13 +263,16 @@ public abstract class MainnetProtocolSpecs { */ public static ProtocolSpec constantinople( final int chainId, final ProtocolSchedule protocolSchedule) { + return constantinopleDefinition(chainId).build(protocolSchedule); + } + + public static ProtocolSpecBuilder constantinopleDefinition(final int chainId) { return byzantiumDefinition(chainId) .difficultyCalculator(MainnetDifficultyCalculators.CONSTANTINOPLE) .gasCalculator(ConstantinopleGasCalculator::new) .evmBuilder(MainnetEvmRegistries::constantinople) .blockReward(CONSTANTINOPLE_BLOCK_REWARD) - .name("Constantinople") - .build(protocolSchedule); + .name("Constantinople"); } private static TransactionReceipt frontierTransactionReceiptFactory(