Browse Source

Added mining hashrate and difficulty to status to the UI

master
Block Tester 11 years ago
parent
commit
049e4ddab6
  1. 16
      network.html
  2. 30
      twister_network.js

16
network.html

@ -154,6 +154,22 @@ @@ -154,6 +154,22 @@
</ul>
</div>
<h2>Block generation status</h2>
<div class="module">
<h3> General information</h3>
<ul>
<li>
<label> Mining difficulty: </label>
<span class="muning-difficulty">0.0</span>
</li>
<li>
<label> Current hash rate: </label>
<span class="muning-hashrate">0</span>
</li>
</ul>
</div>
</div>
</div>

30
twister_network.js

@ -137,6 +137,32 @@ function networkUpdate(cbFunc, cbArg) { @@ -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() { @@ -216,6 +242,10 @@ function initInterfaceNetwork() {
});
networkUpdate();
setInterval("networkUpdate()", 2000);
miningUpdate();
setInterval("miningUpdate()", 2000);
getGenerate();
interfaceNetworkHandlers();

Loading…
Cancel
Save