|
|
@ -40,10 +40,7 @@ public class EthHashrate implements JsonRpcMethod { |
|
|
|
public JsonRpcResponse response(final JsonRpcRequest req) { |
|
|
|
public JsonRpcResponse response(final JsonRpcRequest req) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
final Optional<Long> hashesPerSecond = miningCoordinator.hashesPerSecond(); |
|
|
|
final Optional<Long> hashesPerSecond = miningCoordinator.hashesPerSecond(); |
|
|
|
if (hashesPerSecond.isPresent()) { |
|
|
|
return new JsonRpcSuccessResponse(req.getId(), Quantity.create(hashesPerSecond.orElse(0L))); |
|
|
|
return new JsonRpcSuccessResponse(req.getId(), Quantity.create(hashesPerSecond.get())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new JsonRpcErrorResponse(req.getId(), JsonRpcError.NO_HASHES_PER_SECOND); |
|
|
|
|
|
|
|
} catch (final UnsupportedOperationException ex) { |
|
|
|
} catch (final UnsupportedOperationException ex) { |
|
|
|
return new JsonRpcErrorResponse(req.getId(), JsonRpcError.INVALID_REQUEST); |
|
|
|
return new JsonRpcErrorResponse(req.getId(), JsonRpcError.INVALID_REQUEST); |
|
|
|
} |
|
|
|
} |
|
|
|