From 049e4ddab6f6d44e3d1c9395affcdecb03e32c26 Mon Sep 17 00:00:00 2001 From: Block Tester Date: Wed, 15 Jan 2014 23:22:27 +0000 Subject: [PATCH] Added mining hashrate and difficulty to status to the UI --- network.html | 16 ++++++++++++++++ twister_network.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/network.html b/network.html index 82053eb..d567910 100644 --- a/network.html +++ b/network.html @@ -154,6 +154,22 @@ +

Block generation status

+ +
+

General information

+ +
+ diff --git a/twister_network.js b/twister_network.js index 5fb144e..826d5a6 100644 --- a/twister_network.js +++ b/twister_network.js @@ -137,6 +137,32 @@ function networkUpdate(cbFunc, cbArg) { }); } +function getMiningInfo(cbFunc, cbArg) { + twisterRpc("getmininginfo", [], + function(args, ret) { + miningDifficulty = ret.difficulty; + miningHashRate = ret.hashespersec; + + $(".mining-difficulty").text(miningDifficulty); + $(".mining-hashrate").text(miningHashRate); +/* + if( !twisterdConnections ) { + $.MAL.setNetworkStatusMsg("Connection lost.", false); + twisterdConnectedAndUptodate = false; + } +*/ + if( args.cbFunc ) + args.cbFunc(args.cbArg); + }, {cbFunc:cbFunc, cbArg:cbArg}, + function(args, ret) { + console.log("Error connecting to local twister daemon."); + }, {}); +} + +function miningUpdate(cbFunc, cbArg) { + getMiningInfo(cbFunc, cbArg); +} + function getGenerate() { twisterRpc("getgenerate", [], function(args, ret) { @@ -216,6 +242,10 @@ function initInterfaceNetwork() { }); networkUpdate(); setInterval("networkUpdate()", 2000); + + miningUpdate(); + setInterval("miningUpdate()", 2000); + getGenerate(); interfaceNetworkHandlers();