Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Log milestones at startup and other minor logging improvements #733

Merged
merged 3 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Comparator;
import java.util.NavigableSet;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class MutableProtocolSchedule<C> implements ProtocolSchedule<C> {

Expand Down Expand Up @@ -59,4 +60,12 @@ public ProtocolSpec<C> 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(", ", "[", "]"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import java.util.OptionalLong;
import java.util.function.Function;

public class ProtocolScheduleBuilder<C> {
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ProtocolScheduleBuilder<C> {
private static final Logger LOG = LogManager.getLogger();
private final GenesisConfigOptions config;
private final Function<ProtocolSpecBuilder<Void>, ProtocolSpecBuilder<C>> protocolSpecAdapter;
private final int defaultChainId;
Expand Down Expand Up @@ -91,6 +94,7 @@ public ProtocolSchedule<C> createProtocolSchedule() {
config.getConstantinopleFixBlockNumber(),
MainnetProtocolSpecs.constantinopleFixDefinition(chainId));

LOG.info("Protocol schedule created with milestones: {}", protocolSchedule.listMilestones());
return protocolSchedule;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down