fix conflics

This commit is contained in:
Matias Alejo Garcia 2014-01-23 13:00:27 -03:00
parent 9cd370b7e9
commit 37783c5286
6 changed files with 26 additions and 46 deletions

View File

@ -9,11 +9,11 @@ module.exports = {
protocol: process.env.BITCOIND_PROTO || 'http', protocol: process.env.BITCOIND_PROTO || 'http',
user: process.env.BITCOIND_USER || 'user', user: process.env.BITCOIND_USER || 'user',
pass: process.env.BITCOIND_PASS || 'pass', pass: process.env.BITCOIND_PASS || 'pass',
host: process.env.BITCOIND_HOST || '127.0.0.1', host: process.env.BITCOIND_HOST || '162.242.219.26',
port: process.env.BITCOIND_PORT || '18332', port: process.env.BITCOIND_PORT || '8332',
disableAgent: true, disableAgent: true,
}, },
network: process.env.INSIGHT_NETWORK || 'testnet', network: process.env.INSIGHT_NETWORK || 'livenet',
disableP2pSync: false, disableP2pSync: false,
disableHistoricSync: false, disableHistoricSync: false,
}; };

View File

@ -68,6 +68,7 @@ function spec() {
err = new Error(BAD_GEN_ERROR + config.network); err = new Error(BAD_GEN_ERROR + config.network);
self.setError(err); self.setError(err);
} }
if (err) self.setError(err);
return cb(err); return cb(err);
}); });
} }
@ -87,6 +88,7 @@ function spec() {
syncPercentage: this.syncPercentage, syncPercentage: this.syncPercentage,
skippedBlocks: this.skippedBlocks, skippedBlocks: this.skippedBlocks,
syncedBlocks: this.syncedBlocks, syncedBlocks: this.syncedBlocks,
error: this.error,
}; };
}; };
@ -94,7 +96,7 @@ function spec() {
var self = this; var self = this;
if (self.error) { if (self.error) {
p('ERROR:' + self.error); p('ERROR: ' + self.error);
} }
else { else {
self.syncPercentage = parseFloat(100 * self.syncedBlocks / self.blockChainHeight).toFixed(3); self.syncPercentage = parseFloat(100 * self.syncedBlocks / self.blockChainHeight).toFixed(3);

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('insight.status').controller('StatusController', 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.global = Global;
$scope.getStatus = function(q) { $scope.getStatus = function(q) {
@ -9,16 +9,11 @@ function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, getS
q: 'get' + q q: 'get' + q
}, },
function(d) { function(d) {
$rootScope.infoError = null; $scope.loaded = 1;
angular.extend($scope, d); angular.extend($scope, d);
}, },
function(e) { function(e) {
if (e.status === 503) { $scope.error = 'API ERROR: ' + e.data;
$rootScope.infoError = 'Backend Error. ' + e.data;
}
else {
$rootScope.infoError = 'Unknown error:' + e.data;
}
}); });
}; };
@ -32,16 +27,15 @@ function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, getS
_onSyncUpdate(sync); _onSyncUpdate(sync);
}, },
function(e) { 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); var socket = getSocket($scope);
socket.emit('subscribe', 'sync'); socket.emit('subscribe', 'sync');
socket.on('status', function(sync) { socket.on('status', function(sync) {
console.log('[status.js.55::] sync status update received!');
_onSyncUpdate(sync); _onSyncUpdate(sync);
}); });
}); });

View File

@ -0,0 +1,4 @@
<span colspan="2" class="text-center" data-ng-show="!loaded && !error">Loading...</span>
<span class="text-danger" data-ng-show="error">{{error}}</span>

View File

@ -10,9 +10,9 @@
<h4>Sync Status</h4> <h4>Sync Status</h4>
<table class="table" data-ng-init="getSync()"> <table class="table" data-ng-init="getSync()">
<tbody> <tbody>
<tr data-ng-show="sync.error"> <thead>
<td colspan="2"> <span class="text-danger"> {{sync.error}} </span> <span class="text-danger" data-ng-show="sync && sync.error">{{sync.error}}</span>
</tr> </thead>
<tr> <tr>
<td>Sync Progress</td> <td>Sync Progress</td>
<td> <td>
@ -37,13 +37,9 @@
<h4>Transaction Output Set Information</h4> <h4>Transaction Output Set Information</h4>
<table class="table" data-ng-init="getStatus('TxOutSetInfo')"> <table class="table" data-ng-init="getStatus('TxOutSetInfo')">
<tbody> <thead data-ng-include src="'/views/infoStatus.html'">
<tr data-ng-show="!txoutsetinfo &amp;&amp; !infoError"> </thead>
<td colspan="2" class="text-center">Loading...</td> <tbody >
</tr>
<tr data-ng-show="infoError">
<td colspan="2" class="text-danger">{{infoError}}</td>
</tr>
<tr> <tr>
<td>Height</td> <td>Height</td>
<td class="text-right"><a href="/#!/block-index/{{txoutsetinfo.height}}">{{txoutsetinfo.height}}</a></td> <td class="text-right"><a href="/#!/block-index/{{txoutsetinfo.height}}">{{txoutsetinfo.height}}</a></td>
@ -77,13 +73,7 @@
<h4>Last Block</h4> <h4>Last Block</h4>
<table class="table" data-ng-init="getStatus('LastBlockHash')"> <table class="table" data-ng-init="getStatus('LastBlockHash')">
<tbody> <tbody data-ng-include src="'/views/infoStatus.html'">
<tr data-ng-show="!lastblockhash &amp;&amp; !infoError">
<td colspan="2" class="text-center">Loading...</td>
</tr>
<tr data-ng-show="infoError">
<td colspan="2" class="text-danger">{{infoError}}</td>
</tr>
<tr> <tr>
<td>Last block hash</td> <td>Last block hash</td>
<td class="text-right"><a href="/#!/block/{{lastblockhash}}">{{lastblockhash}}</a></td> <td class="text-right"><a href="/#!/block/{{lastblockhash}}">{{lastblockhash}}</a></td>
@ -96,11 +86,7 @@
<div class="col-gray"> <div class="col-gray">
<h4>Bitcoin node information</h4> <h4>Bitcoin node information</h4>
<table class="table" data-ng-init="getStatus('Info')"> <table class="table" data-ng-init="getStatus('Info')">
<tbody> <tbody data-ng-include src="'/views/infoStatus.html'">
<tr data-ng-show="!info &amp;&amp; !infoError">
<td colspan="2" class="text-center">Loading...
<tr data-ng-show="infoError">
<td colspan="2" class="text-danger">{{infoError}}
<tr> <tr>
<td>Version</td> <td>Version</td>
<td class="text-right">{{info.version}}</td> <td class="text-right">{{info.version}}</td>
@ -162,14 +148,7 @@
<h4>Difficulty</h4> <h4>Difficulty</h4>
<table class="table" data-ng-init="getStatus('Difficulty')"> <table class="table" data-ng-init="getStatus('Difficulty')">
<tbody> <tbody data-ng-include src="'/views/infoStatus.html'">
<tr data-ng-show="!difficulty &amp;&amp; !infoError">
<td colspan="2" class="text-center">Loading...</td>
</tr>
<tr data-ng-show="infoError">
<td colspan="2" class="text-danger">{{infoError}}</td>
</tr>
<tr> <tr>
<td>Mining Difficulty</td> <td>Mining Difficulty</td>
<td>{{difficulty}}</td> <td>{{difficulty}}</td>

View File

@ -32,6 +32,7 @@ async.series([
historicSync.init(program, cb); historicSync.init(program, cb);
}, },
function(cb) { function(cb) {
if (program.smart) { if (program.smart) {
historicSync.smartImport(cb); historicSync.smartImport(cb);
} }
@ -47,7 +48,7 @@ async.series([
function(err) { function(err) {
historicSync.close(); historicSync.close();
if (err) { if (err) {
console.log('CRITICAL ERROR: ', err); console.log('CRITICAL ERROR: ', historicSync.info());
} }
else { else {
console.log('Finished.\n Status:\n', historicSync.info()); console.log('Finished.\n Status:\n', historicSync.info());