From 5029a62d5a4ca8471ab84bb7f6a10341f739db96 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Fri, 1 Feb 2019 07:02:38 +1000 Subject: [PATCH 1/3] Log the milestone blocks in use at startup. --- .../ethereum/mainnet/MutableProtocolSchedule.java | 9 +++++++++ .../ethereum/mainnet/ProtocolScheduleBuilder.java | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MutableProtocolSchedule.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MutableProtocolSchedule.java index ca3bdd87da..fc4654df77 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MutableProtocolSchedule.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/MutableProtocolSchedule.java @@ -17,6 +17,7 @@ import java.util.Comparator; import java.util.NavigableSet; import java.util.TreeSet; +import java.util.stream.Collectors; public class MutableProtocolSchedule implements ProtocolSchedule { @@ -59,4 +60,12 @@ public ProtocolSpec getByBlockNumber(final long number) { } return null; } + + public String listMilestones() { + return protocolSpecs + .stream() + .sorted(Comparator.comparing(ScheduledProtocolSpec::getBlock)) + .map(spec -> spec.getSpec().getName() + ": " + spec.getBlock()) + .collect(Collectors.joining(", ", "[", "]")); + } } diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/ProtocolScheduleBuilder.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/ProtocolScheduleBuilder.java index 8c6ea64a8e..feb7d40e7a 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/ProtocolScheduleBuilder.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/ProtocolScheduleBuilder.java @@ -18,8 +18,11 @@ import java.util.OptionalLong; import java.util.function.Function; -public class ProtocolScheduleBuilder { +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +public class ProtocolScheduleBuilder { + private static final Logger LOG = LogManager.getLogger(); private final GenesisConfigOptions config; private final Function, ProtocolSpecBuilder> protocolSpecAdapter; private final int defaultChainId; @@ -91,6 +94,7 @@ public ProtocolSchedule createProtocolSchedule() { config.getConstantinopleFixBlockNumber(), MainnetProtocolSpecs.constantinopleFixDefinition(chainId)); + LOG.info("Protocol schedule created with milestones: {}", protocolSchedule.listMilestones()); return protocolSchedule; } From 09b3ce7a59da5da7338adb8527978da21e46671a Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Fri, 1 Feb 2019 07:02:55 +1000 Subject: [PATCH 2/3] Remove duplicate word "key" in log message when new key is generated. --- .../main/java/tech/pegasys/pantheon/controller/KeyPairUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/KeyPairUtil.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/KeyPairUtil.java index 1b6561212e..60c62f572b 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/KeyPairUtil.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/controller/KeyPairUtil.java @@ -33,7 +33,7 @@ public static SECP256K1.KeyPair loadKeyPair(final File keyFile) throws IOExcepti key = SECP256K1.KeyPair.generate(); key.getPrivateKey().store(keyFile); LOG.info( - "Generated new key key {} and stored it to {}", + "Generated new key {} and stored it to {}", key.getPublicKey().toString(), keyFile.getAbsolutePath()); } From 42271bf5fdc5486607ac26c007e847693a1b6cef Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Fri, 1 Feb 2019 07:03:10 +1000 Subject: [PATCH 3/3] Don't log that mining is paused while behind chain head when mining is not enabled. --- .../ethereum/blockcreation/AbstractMiningCoordinator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethereum/blockcreation/src/main/java/tech/pegasys/pantheon/ethereum/blockcreation/AbstractMiningCoordinator.java b/ethereum/blockcreation/src/main/java/tech/pegasys/pantheon/ethereum/blockcreation/AbstractMiningCoordinator.java index 1b477e3fcb..dd00249542 100644 --- a/ethereum/blockcreation/src/main/java/tech/pegasys/pantheon/ethereum/blockcreation/AbstractMiningCoordinator.java +++ b/ethereum/blockcreation/src/main/java/tech/pegasys/pantheon/ethereum/blockcreation/AbstractMiningCoordinator.java @@ -113,7 +113,9 @@ public void inSyncChanged(final boolean inSync) { LOG.info("Resuming mining operations"); startAsyncMiningOperation(); } else if (!inSync) { - LOG.info("Pausing mining while behind chain head"); + if (isEnabled) { + LOG.info("Pausing mining while behind chain head"); + } haltCurrentMiningOperation(); } }