selaux / miner-dashboard

Node.js based app to show the current status of your miner in a browser.
37 stars 15 forks source link

Last Share Submitted for Pool data shows "Invalid Date" with later versions of CGMiner #31

Closed jedimstr closed 10 years ago

jedimstr commented 10 years ago

Last Share Submitted for Pool data shows "Invalid Date" with later versions of CGMiner used on Antminer S1's.

jedi s lair mining operations miner dashboard

The actual issue is because formatting/data for Pool last share data is different than what is shown for what's available under the devs command:

{"command":"pools"}

{
  "POOLS": [
    {
      "Accepted": 8554, 
      "Best Share": 108758634, 
      "Diff": "188", 
      "Diff1 Shares": 1493407, 
      "Difficulty Accepted": 1427001.9025646, 
      "Difficulty Rejected": 64912.60599115, 
      "Difficulty Stale": 0.0, 
      "Discarded": 2324, 
      "Get Failures": 0, 
      "Getworks": 1506, 
      "Has GBT": false, 
      "Has Stratum": true, 
      "Last Share Difficulty": 188.03526569, 
      "Last Share Time": "0:00:01", 
      "Long Poll": "N", 
      "POOL": 0, 
      "Pool Rejected%": 4.351, 
      "Pool Stale%": 0.0, 
      "Priority": 0, 
      "Proxy": "", 
      "Proxy Type": "", 
      "Quota": 1, 
      "Rejected": 385, 
      "Remote Failures": 0, 
      "Stale": 0, 
      "Status": "Alive", 
      "Stratum Active": true, 
      "Stratum URL": "192.168.1.2", 
      "URL": "stratum+tcp://192.168.1.2:9332", 
      "User": "144eLZfotuWsNANJFGDWco358tv2fS4UCV"
    }, 
    {
      "Accepted": 0, 
      "Best Share": 0, 
      "Diff": "1K", 
      "Diff1 Shares": 0, 
      "Difficulty Accepted": 0.0, 
      "Difficulty Rejected": 0.0, 
      "Difficulty Stale": 0.0, 
      "Discarded": 0, 
      "Get Failures": 0, 
      "Getworks": 2, 
      "Has GBT": false, 
      "Has Stratum": true, 
      "Last Share Difficulty": 0.0, 
      "Last Share Time": "0", 
      "Long Poll": "N", 
      "POOL": 1, 
      "Pool Rejected%": 0.0, 
      "Pool Stale%": 0.0, 
      "Priority": 1, 
      "Proxy": "", 
      "Proxy Type": "", 
      "Quota": 1, 
      "Rejected": 0, 
      "Remote Failures": 0, 
      "Stale": 0, 
      "Status": "Alive", 
      "Stratum Active": false, 
      "Stratum URL": "", 
      "URL": "stratum+tcp://elizium.name:9332", 
      "User": "144eLZfotuWsNANJFGDWco358tv2fS4UCV"
    }, 
    {
      "Accepted": 0, 
      "Best Share": 0, 
      "Diff": "128", 
      "Diff1 Shares": 0, 
      "Difficulty Accepted": 0.0, 
      "Difficulty Rejected": 0.0, 
      "Difficulty Stale": 0.0, 
      "Discarded": 0, 
      "Get Failures": 0, 
      "Getworks": 2, 
      "Has GBT": false, 
      "Has Stratum": true, 
      "Last Share Difficulty": 0.0, 
      "Last Share Time": "0", 
      "Long Poll": "N", 
      "POOL": 2, 
      "Pool Rejected%": 0.0, 
      "Pool Stale%": 0.0, 
      "Priority": 2, 
      "Proxy": "", 
      "Proxy Type": "", 
      "Quota": 1, 
      "Rejected": 0, 
      "Remote Failures": 0, 
      "Stale": 0, 
      "Status": "Alive", 
      "Stratum Active": false, 
      "Stratum URL": "", 
      "URL": "stratum+tcp://stratum.btcguild.com:3333", 
      "User": "jedimstr_Valkyrie"
    }
  ], 
  "STATUS": [
    {
      "Code": 7, 
      "Description": "cgminer 3.12.0", 
      "Msg": "3 Pool(s)", 
      "STATUS": "S", 
      "When": 1392295653
    }
  ], 
  "id": 1
}

{"command":"devs"}

{
  "DEVS": [
    {
      "ASC": 0, 
      "Accepted": 8273, 
      "Device Elapsed": 30951, 
      "Device Hardware%": 0.348, 
      "Device Rejected%": 4.4099, 
      "Diff1 Work": 1445483, 
      "Difficulty Accepted": 1374492.24840531, 
      "Difficulty Rejected": 63744.14563903, 
      "Enabled": "Y", 
      "Hardware Errors": 5048, 
      "ID": 0, 
      "Last Share Difficulty": 199.11716593, 
      "Last Share Pool": 0, 
      "Last Share Time": 1392294615, 
      "Last Valid Work": 1392294624, 
      "MHS 5s": 195597.7, 
      "MHS av": 200586.52, 
      "Name": "BMM", 
      "No Device": false, 
      "Rejected": 379, 
      "Status": "Alive", 
      "Temperature": 44.0, 
      "Total MH": 6208280735.6456, 
      "Utility": 16.04
    }
  ], 
  "STATUS": [
    {
      "Code": 9, 
      "Description": "cgminer 3.12.0", 
      "Msg": "1 ASC(s)", 
      "STATUS": "S", 
      "When": 1392294624
    }
  ], 
  "id": 1
}
jedimstr commented 10 years ago

Here's a reply from Kano in the BitcoinTalk Forums on the custom CGMiner version used in the Antminer S1 and the API issues I posted here.

This affects both the Last Time Share issue as well as the improper Hashrate display for summary command. https://bitcointalk.org/index.php?topic=28402.msg5155782#msg5155782

They feel the need to change the API.
They are morons.

It is not changed in master cgminer.

I have made sure that the cgminer API is backward compatible since I first wrote it.
The only things changed have been to remove CPU and GPU information (since they don't exist in cgminer)

Unfortunately, the idiots who make the Antminer, break this compatibility by changing names and values in the API in their clone of cgminer.
You will also find that they changed the name of the fields and values that report the hash rate in the summary.
So basically what it means is that either everyone who has ever written a program or script to access the API must modify their code to support these random needless changes, or tell them to stop fucking with the API and making it no longer compatible.

Edit: they were probably stupid enough to also not notice that STATUS->When is the time of the results - so the difference between 'When' and 'Last Share Time' will tell you how long ago it is if you want to display it differently ......... (as I already do in miner.php for 'Last Valid Work')