From b7acf0f737605dce10561879d1cfb2dab21de93f Mon Sep 17 00:00:00 2001 From: tmohay <37158202+rain-on@users.noreply.github.com> Date: Fri, 12 Oct 2018 12:20:31 +1100 Subject: [PATCH] Repair hashrate capture in ethhashmining coordinator (#39) On the transition to the EthHash/Clique Mining Coordinator a change was lost whereby the EthHashMiningCoordinator is to capture the current Hashrate on cancellation of a mining operation. --- .../ethereum/blockcreation/EthHashMiningCoordinator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/EthHashMiningCoordinator.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/EthHashMiningCoordinator.java index 2d57b539e9..2bffd83913 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/EthHashMiningCoordinator.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/EthHashMiningCoordinator.java @@ -58,4 +58,13 @@ public class EthHashMiningCoordinator extends AbstractMiningCoordinator miner.submitWork(solution)).orElse(false); } } + + @Override + protected void haltCurrentMiningOperation() { + currentRunningMiner.ifPresent( + miner -> { + miner.cancel(); + miner.getHashesPerSecond().ifPresent(val -> cachedHashesPerSecond = Optional.of(val)); + }); + } }