From 302fd41b42e73c89b33f0a4d8c3663ef5b7fb8ed Mon Sep 17 00:00:00 2001 From: tmohay <37158202+rain-on@users.noreply.github.com> Date: Tue, 23 Oct 2018 12:53:01 +1100 Subject: [PATCH] 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. --- .../pantheon/controller/CliquePantheonController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/CliquePantheonController.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/CliquePantheonController.java index bbf6445dca..920aff16d2 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/CliquePantheonController.java +++ b/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 SECONDS_BETWEEN_BLOCKS_DEFAULT = 15L; + private final CliqueMiningCoordinator miningCoordinator; CliquePantheonController( final GenesisConfig genesisConfig, @@ -82,6 +83,7 @@ public class CliquePantheonController final Synchronizer synchronizer, final KeyPair keyPair, final TransactionPool transactionPool, + final CliqueMiningCoordinator miningCoordinator, final Runnable closer) { this.genesisConfig = genesisConfig; @@ -91,6 +93,7 @@ public class CliquePantheonController this.keyPair = keyPair; this.transactionPool = transactionPool; this.closer = closer; + this.miningCoordinator = miningCoordinator; } public static PantheonController init( @@ -174,6 +177,7 @@ public class CliquePantheonController synchronizer, nodeKeys, transactionPool, + miningCoordinator, () -> { miningCoordinator.disable(); minerThreadPool.shutdownNow(); @@ -218,7 +222,7 @@ public class CliquePantheonController @Override public AbstractMiningCoordinator getMiningCoordinator() { - return null; + return miningCoordinator; } @Override