diff --git a/app.js b/app.js index eb5ca75..04ee736 100644 --- a/app.js +++ b/app.js @@ -94,5 +94,5 @@ function Application() { } -GLOBAL.app = new Application(); +global.app = new Application(); diff --git a/node_modules/bitcoin/lib/bitcoin/client.js b/node_modules/bitcoin/lib/bitcoin/client.js index 10ae6ce..6834151 100644 --- a/node_modules/bitcoin/lib/bitcoin/client.js +++ b/node_modules/bitcoin/lib/bitcoin/client.js @@ -15,6 +15,7 @@ var bitcoinAPI = { getAddressesByAccount: 'getaddressesbyaccount', getBalance: 'getbalance', getBlock: 'getblock', + getBlockchainInfo: 'getblockchaininfo', getBlockCount: 'getblockcount', getBlockHash: 'getblockhash', getConnectionCount: 'getconnectioncount', diff --git a/testnet.js b/testnet.js index 8f5b053..83eb96c 100644 --- a/testnet.js +++ b/testnet.js @@ -210,7 +210,7 @@ function Application() { } function update_status() { - self.client.getInfo(function(err, info) { + self.client.getBlockchainInfo(function(err, info) { if(err) console.error("getInfo error:",err); self.status.info = info; @@ -267,7 +267,7 @@ function Application() { dpc(2000, init); } -GLOBAL.app = new Application(); +global.app = new Application(); /* diff --git a/views/index.ejs b/views/index.ejs index cab56ee..3e65168 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -58,7 +58,7 @@ function Application() { // --- _.each(response.last_blocks, function(o) { - str += ""+o.height+" - "+o.hash+"
"; + str += ""+o.height+" - "+o.hash+"
"; }); $("#last_blocks").html(str); @@ -68,6 +68,33 @@ function Application() { str = "" _.each(response.info, function(v,n) { str += ""; })
"+n+""; + + switch (n) { + case "bestblockhash": { + var link = ""+v+" "; + v = link + break; + } + case "softforks": { + var softforks = ""; + _.each(response.info.softforks, function(softfork) { + softforks += softfork.id + ", "; + }); + v = softforks.substr(0, softforks.length-2); + break; + } + case "bip9_softforks": { + var bip9softforks = ""; + _.each(response.info.bip9_softforks, function(val, name) { + bip9softforks += name + " (" + val.status + "), "; + }); + v = bip9softforks.substr(0, bip9softforks.length-2); + break; + } + default: + break; + } + str += v; str += "