CliquePantheonController exposes mining coordinator (#117)

Previously the getMiningCoordinator() function on the
CliquePantheonController returned 'null' as a stub.

In order for the JSON RPC to operate correctly this function needs
to return the mining coordinator created during PantheonController
initialisation - which is the change introduced through this commit.
tmohay 6 years ago committed by GitHub
parent 2862f54f55
commit 302fd41b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      pantheon/src/main/java/tech/pegasys/pantheon/controller/CliquePantheonController.java

@ -74,6 +74,7 @@ public class CliquePantheonController
private static final long EPOCH_LENGTH_DEFAULT = 30_000L; private static final long EPOCH_LENGTH_DEFAULT = 30_000L;
private static final long SECONDS_BETWEEN_BLOCKS_DEFAULT = 15L; private static final long SECONDS_BETWEEN_BLOCKS_DEFAULT = 15L;
private final CliqueMiningCoordinator miningCoordinator;
CliquePantheonController( CliquePantheonController(
final GenesisConfig<CliqueContext> genesisConfig, final GenesisConfig<CliqueContext> genesisConfig,
@ -82,6 +83,7 @@ public class CliquePantheonController
final Synchronizer synchronizer, final Synchronizer synchronizer,
final KeyPair keyPair, final KeyPair keyPair,
final TransactionPool transactionPool, final TransactionPool transactionPool,
final CliqueMiningCoordinator miningCoordinator,
final Runnable closer) { final Runnable closer) {
this.genesisConfig = genesisConfig; this.genesisConfig = genesisConfig;
@ -91,6 +93,7 @@ public class CliquePantheonController
this.keyPair = keyPair; this.keyPair = keyPair;
this.transactionPool = transactionPool; this.transactionPool = transactionPool;
this.closer = closer; this.closer = closer;
this.miningCoordinator = miningCoordinator;
} }
public static PantheonController<CliqueContext, CliqueBlockMiner> init( public static PantheonController<CliqueContext, CliqueBlockMiner> init(
@ -174,6 +177,7 @@ public class CliquePantheonController
synchronizer, synchronizer,
nodeKeys, nodeKeys,
transactionPool, transactionPool,
miningCoordinator,
() -> { () -> {
miningCoordinator.disable(); miningCoordinator.disable();
minerThreadPool.shutdownNow(); minerThreadPool.shutdownNow();
@ -218,7 +222,7 @@ public class CliquePantheonController
@Override @Override
public AbstractMiningCoordinator<CliqueContext, CliqueBlockMiner> getMiningCoordinator() { public AbstractMiningCoordinator<CliqueContext, CliqueBlockMiner> getMiningCoordinator() {
return null; return miningCoordinator;
} }
@Override @Override

Loading…
Cancel
Save