threefoldfoundation / tfchain

Official implementation of the ThreeFold blockchain
https://explorer.threefoldtoken.com
Apache License 2.0
13 stars 7 forks source link

Confirmed Coin Balance shows NaN billion TFT #347

Closed zaibon closed 5 years ago

zaibon commented 5 years ago

To reproduce, go to: https://explorer.testnet.threefoldtoken.com/hash.html?hash=0128b01507b17175f99fb4ca0fadf9115a3e85aae89b8dcdca9b610469281de9e849cf16c9afcd

GlenDC commented 5 years ago

Already fixed in the master branch, however we haven't updated test (let alone standard net) nodes for a long time. We'll need to make a new version of the node software for both nets ASAP.

Screenshot 2019-06-10 at 16 09 41

You can confirm it yourself by:

  1. applying this patch (it will use the official explorer's node as backend so you do not have to have an update explorer node yourself (locally)):
    
    diff --git a/frontend/explorer/public/js/block.js b/frontend/explorer/public/js/block.js
    index 73f82b3..8f45dc0 100644
    --- a/frontend/explorer/public/js/block.js
    +++ b/frontend/explorer/public/js/block.js
    @@ -2,7 +2,7 @@
    // presented.
    function fillBlock(height) {
    var request = new XMLHttpRequest();
    -   var reqString = '/explorer/blocks/' + height;
    +   var reqString = 'https://explorer.testnet.threefoldtoken.com/explorer/blocks/' + height;
    request.open('GET', reqString, false);
    request.send();
    var infoBody = document.getElementById('dynamic-elements');
    diff --git a/frontend/explorer/public/js/graphs.js b/frontend/explorer/public/js/graphs.js
    index 7df6e83..9ad93b2 100644
    --- a/frontend/explorer/public/js/graphs.js
    +++ b/frontend/explorer/public/js/graphs.js
    @@ -224,7 +224,7 @@ function hashDetailPage(hash) {
    function getRangeStats(start, end) {
     return new Promise(function(resolve, reject) {
         var request = new XMLHttpRequest();
    -        request.open('GET', '/explorer/stats/range?start=' + start + '&end=' + end, true);
    +        request.open('GET', 'https://explorer.testnet.threefoldtoken.com/explorer/stats/range?start=' + start + '&end=' + end, true);
         request.onload = function() {
             if (request.status != 200) {
                 console.log(request);
    @@ -239,7 +239,7 @@ function getRangeStats(start, end) {
    function getHistoryStats(history) {
     return new Promise(function(resolve, reject) {
         var request = new XMLHttpRequest();
    -        request.open('GET', '/explorer/stats/history?history=' + history, true);
    +        request.open('GET', 'https://explorer.testnet.threefoldtoken.com/explorer/stats/history?history=' + history, true);
         request.onload = function() {
             if (request.status != 200) {
                 reject(request.status);
    @@ -253,7 +253,7 @@ function getHistoryStats(history) {
    function getLatestBlockFacts() {
     return new Promise(function(resolve, reject) {
         var request = new XMLHttpRequest();
    -        request.open('GET', '/explorer', true);
    +        request.open('GET', 'https://explorer.testnet.threefoldtoken.com/explorer', true);
         request.onload = function() {
             if (request.status != 200) {
                 reject(request.status);
    diff --git a/frontend/explorer/public/js/hash.js b/frontend/explorer/public/js/hash.js
    index e2fd999..356683c 100644
    --- a/frontend/explorer/public/js/hash.js
    +++ b/frontend/explorer/public/js/hash.js
    @@ -2745,7 +2745,7 @@ function appendNavigationInvalidHash() {
    // fills out the page with the response.
    function fetchHashInfo(hash) {
    var request = new XMLHttpRequest();
    -   var reqString = '/explorer/hashes/' + hash;
    +   var reqString = 'https://explorer.testnet.threefoldtoken.com/explorer/hashes/' + hash;
    request.open('GET', reqString, false);
    request.send();
    if (request.status != 200) {
    diff --git a/frontend/explorer/public/js/index.js b/frontend/explorer/public/js/index.js
    index e1ac90f..31ce088 100644
    --- a/frontend/explorer/public/js/index.js
    +++ b/frontend/explorer/public/js/index.js
    @@ -1,6 +1,6 @@
    function fillGeneralStats() {
    var request = new XMLHttpRequest();
    -   request.open('GET', '/explorer', true);
    +   request.open('GET', 'https://explorer.testnet.threefoldtoken.com/explorer', true);
    request.onload = function() {
        var explorerStatus = JSON.parse(request.responseText);

diff --git a/frontend/explorer/public/js/main.js b/frontend/explorer/public/js/main.js index 855c918..ea13168 100644 --- a/frontend/explorer/public/js/main.js +++ b/frontend/explorer/public/js/main.js @@ -259,7 +259,7 @@ function appendBlockStatistics(domParent, explorerBlock) { // getBlockchainTime gets the current blockchain time function getBlockchainContext() { var request = new XMLHttpRequest();

You'll see that the NaN error is no longer there.