Browse Source

solo: improve getmininginfo

2upstream
Tanguy Pruvot 10 years ago
parent
commit
d923f0c1b2
  1. 10
      ccminer.cpp

10
ccminer.cpp

@ -1038,15 +1038,23 @@ static bool get_mininginfo(CURL *curl, struct work *work)
// "blocks": 491493 (= current work height - 1) // "blocks": 491493 (= current work height - 1)
// "difficulty": 0.99607860999999998 // "difficulty": 0.99607860999999998
// "networkhashps": 56475980 // "networkhashps": 56475980
// "netmhashps": 351.74414726
if (res) { if (res) {
json_t *key = json_object_get(res, "difficulty"); json_t *key = json_object_get(res, "difficulty");
if (key && json_is_real(key)) { if (key) {
if (!json_is_real(key))
key = json_object_get(key, "proof-of-work");
if (json_is_real(key))
net_diff = json_real_value(key); net_diff = json_real_value(key);
} }
key = json_object_get(res, "networkhashps"); key = json_object_get(res, "networkhashps");
if (key && json_is_integer(key)) { if (key && json_is_integer(key)) {
net_hashrate = json_integer_value(key); net_hashrate = json_integer_value(key);
} }
key = json_object_get(res, "netmhashps");
if (key && json_is_real(key)) {
net_hashrate = (json_real_value(key) * 1e6);
}
key = json_object_get(res, "blocks"); key = json_object_get(res, "blocks");
if (key && json_is_integer(key)) { if (key && json_is_integer(key)) {
net_blocks = json_integer_value(key); net_blocks = json_integer_value(key);

Loading…
Cancel
Save