Support Constantinople when using Clique. (#247)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Adrian Sutton 6 years ago committed by GitHub
parent 422ef0d4c6
commit b365294590
  1. 4
      consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSchedule.java
  2. 4
      consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/CliqueProtocolSpecs.java
  3. 7
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MainnetProtocolSpecs.java

@ -60,6 +60,10 @@ public class CliqueProtocolSchedule extends MutableProtocolSchedule<CliqueContex
config
.getByzantiumBlockNumber()
.ifPresent(blockNumber -> protocolSchedule.putMilestone(blockNumber, specs.byzantium()));
config
.getConstantinopleBlockNumber()
.ifPresent(
blockNumber -> protocolSchedule.putMilestone(blockNumber, specs.constantinople()));
return protocolSchedule;
}

@ -66,6 +66,10 @@ public class CliqueProtocolSpecs {
return applyCliqueSpecificModifications(MainnetProtocolSpecs.byzantiumDefinition(chainId));
}
public ProtocolSpec<CliqueContext> constantinople() {
return applyCliqueSpecificModifications(MainnetProtocolSpecs.constantinopleDefinition(chainId));
}
private ProtocolSpec<CliqueContext> applyCliqueSpecificModifications(
final ProtocolSpecBuilder<Void> specBuilder) {
final EpochManager epochManager = new EpochManager(epochLength);

@ -263,13 +263,16 @@ public abstract class MainnetProtocolSpecs {
*/
public static ProtocolSpec<Void> constantinople(
final int chainId, final ProtocolSchedule<Void> protocolSchedule) {
return constantinopleDefinition(chainId).build(protocolSchedule);
}
public static ProtocolSpecBuilder<Void> 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(

Loading…
Cancel
Save