From 37783c5286e02770e665c7e923366deb267506b5 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 23 Jan 2014 13:00:27 -0300 Subject: [PATCH] fix conflics --- config/env/development.js | 6 ++--- lib/HistoricSync.js | 4 +++- public/js/controllers/status.js | 16 +++++--------- public/views/infoStatus.html | 4 ++++ public/views/status.html | 39 ++++++++------------------------- util/sync.js | 3 ++- 6 files changed, 26 insertions(+), 46 deletions(-) create mode 100644 public/views/infoStatus.html diff --git a/config/env/development.js b/config/env/development.js index c46c11ef..36ef11ca 100755 --- a/config/env/development.js +++ b/config/env/development.js @@ -9,11 +9,11 @@ module.exports = { protocol: process.env.BITCOIND_PROTO || 'http', user: process.env.BITCOIND_USER || 'user', pass: process.env.BITCOIND_PASS || 'pass', - host: process.env.BITCOIND_HOST || '127.0.0.1', - port: process.env.BITCOIND_PORT || '18332', + host: process.env.BITCOIND_HOST || '162.242.219.26', + port: process.env.BITCOIND_PORT || '8332', disableAgent: true, }, - network: process.env.INSIGHT_NETWORK || 'testnet', + network: process.env.INSIGHT_NETWORK || 'livenet', disableP2pSync: false, disableHistoricSync: false, }; diff --git a/lib/HistoricSync.js b/lib/HistoricSync.js index e70b4b6d..a7265d14 100644 --- a/lib/HistoricSync.js +++ b/lib/HistoricSync.js @@ -68,6 +68,7 @@ function spec() { err = new Error(BAD_GEN_ERROR + config.network); self.setError(err); } + if (err) self.setError(err); return cb(err); }); } @@ -87,6 +88,7 @@ function spec() { syncPercentage: this.syncPercentage, skippedBlocks: this.skippedBlocks, syncedBlocks: this.syncedBlocks, + error: this.error, }; }; @@ -94,7 +96,7 @@ function spec() { var self = this; if (self.error) { - p('ERROR:' + self.error); + p('ERROR: ' + self.error); } else { self.syncPercentage = parseFloat(100 * self.syncedBlocks / self.blockChainHeight).toFixed(3); diff --git a/public/js/controllers/status.js b/public/js/controllers/status.js index 70544804..15d7a7d4 100644 --- a/public/js/controllers/status.js +++ b/public/js/controllers/status.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('insight.status').controller('StatusController', -function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, getSocket) { +function($scope, $routeParams, $location, Global, Status, Sync, getSocket) { $scope.global = Global; $scope.getStatus = function(q) { @@ -9,16 +9,11 @@ function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, getS q: 'get' + q }, function(d) { - $rootScope.infoError = null; + $scope.loaded = 1; angular.extend($scope, d); }, function(e) { - if (e.status === 503) { - $rootScope.infoError = 'Backend Error. ' + e.data; - } - else { - $rootScope.infoError = 'Unknown error:' + e.data; - } + $scope.error = 'API ERROR: ' + e.data; }); }; @@ -32,16 +27,15 @@ function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, getS _onSyncUpdate(sync); }, function(e) { - $scope.sync = { error: 'Could not get sync information' + e }; + var err = 'Could not get sync information' + e.toString(); + $scope.sync = { error: err }; }); }; var socket = getSocket($scope); socket.emit('subscribe', 'sync'); socket.on('status', function(sync) { - console.log('[status.js.55::] sync status update received!'); _onSyncUpdate(sync); }); - }); diff --git a/public/views/infoStatus.html b/public/views/infoStatus.html new file mode 100644 index 00000000..d2e250cd --- /dev/null +++ b/public/views/infoStatus.html @@ -0,0 +1,4 @@ +Loading... +{{error}} + + diff --git a/public/views/status.html b/public/views/status.html index ab26f957..4f9cb6a6 100644 --- a/public/views/status.html +++ b/public/views/status.html @@ -10,9 +10,9 @@

Sync Status

- - + + {{sync.error}} +
{{sync.error}} -
Sync Progress @@ -37,13 +37,9 @@

Transaction Output Set Information

- - - - - - - + + + @@ -77,13 +73,7 @@

Last Block

Loading...
{{infoError}}
Height {{txoutsetinfo.height}}
- - - - - - - + @@ -96,11 +86,7 @@

Bitcoin node information

Loading...
{{infoError}}
Last block hash {{lastblockhash}}
- - - - @@ -162,14 +148,7 @@

Difficulty

Loading... -
{{infoError}} +
Version {{info.version}}
- - - - - - - - + diff --git a/util/sync.js b/util/sync.js index 2dd4f15f..0ffda1f1 100755 --- a/util/sync.js +++ b/util/sync.js @@ -32,6 +32,7 @@ async.series([ historicSync.init(program, cb); }, function(cb) { + if (program.smart) { historicSync.smartImport(cb); } @@ -47,7 +48,7 @@ async.series([ function(err) { historicSync.close(); if (err) { - console.log('CRITICAL ERROR: ', err); + console.log('CRITICAL ERROR: ', historicSync.info()); } else { console.log('Finished.\n Status:\n', historicSync.info());
Loading...
{{infoError}}
Mining Difficulty {{difficulty}}