Skip to content

Commit

Permalink
Merge pull request ethereumclassic#198 from naikmyeong/blockdiff
Browse files Browse the repository at this point in the history
Fix block total difficulty
  • Loading branch information
pyskell authored Feb 11, 2019
2 parents c3c2e47 + d9097f1 commit 31e5bf0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions public/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,26 @@ var getDifficulty = function(hashes) {
unit = 'G';
}

if(hashes >= Math.pow(1000, 4) ) {
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) {
result = hashes / Math.pow(1000, 4);
unit = 'T';
}

if(hashes >= Math.pow(1000, 5) && hashes < Math.pow(1000, 6)) {
result = hashes / Math.pow(1000, 5);
unit = 'P';
}

if(hashes >= Math.pow(1000, 6) && hashes < Math.pow(1000, 7)) {
result = hashes / Math.pow(1000, 6);
unit = 'E';
}

if(hashes >= Math.pow(1000, 7) ) {
result = hashes / Math.pow(1000, 7);
unit = 'Z';
}

return result.toFixed(2) + ' ' + unit + 'H';
}

Expand Down Expand Up @@ -63,4 +79,4 @@ var getDuration = function(timestamp){
}).join(', ');
};
return dur;
};
};
2 changes: 1 addition & 1 deletion public/views/block.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<tr ><td width="25%">sha3 Uncles</td><td>{{block.sha3Uncles}}</td></tr>
<tr ><td width="25%">Mined By</td><td><a href="/addr/{{block.miner}}">{{block.miner}}</td></tr>
<tr ><td width="25%">Difficulty</td><td>{{block.difficulty | totalDifficulty}}</td></tr>
<tr ><td width="25%">Total Difficulty</td><td>{{block.totalDifficulty | teraHashes | number}} TH</td></tr>
<tr ><td width="25%">Total Difficulty</td><td>{{block.totalDifficulty | totalDifficulty}}</td></tr>
<tr ><td width="25%">Gas Limit</td><td>{{block.gasLimit | number}}</td></tr>
<tr ><td width="25%">Gas Used</td><td>{{block.gasUsed | number}}</td></tr>
<tr ><td width="25%">nonce</td><td>{{block.nonce}}</td></tr>
Expand Down

0 comments on commit 31e5bf0

Please sign in to comment.