Merge branch 'master' of github.com:bitpay/insight into easy-install

This commit is contained in:
Eric Martindale 2014-01-21 22:52:53 +00:00
commit 32ed8497e5
10 changed files with 227 additions and 209 deletions

View File

@ -26,6 +26,6 @@ module.exports.broadcast_address_tx = function(address, tx) {
ios.sockets.in(address).emit('atx', tx); ios.sockets.in(address).emit('atx', tx);
}; };
module.exports.broadcastSyncInfo = function(syncInfo) { module.exports.broadcastSyncInfo = function(historicSync) {
ios.sockets.in('sync').emit('status', syncInfo); ios.sockets.in('sync').emit('status', historicSync);
}; };

View File

@ -50,6 +50,6 @@ exports.show = function(req, res) {
}; };
exports.sync = function(req, res) { exports.sync = function(req, res) {
if (req.syncInfo) if (req.historicSync)
res.jsonp(req.syncInfo); res.jsonp(req.historicSync.info());
}; };

View File

@ -31,7 +31,7 @@ module.exports = function(app, historicSync) {
//custom middleware //custom middleware
function setHistoric(req, res, next) { function setHistoric(req, res, next) {
req.syncInfo = historicSync.syncInfo; req.historicSync = historicSync;
next(); next();
} }
app.use('/api/sync', setHistoric); app.use('/api/sync', setHistoric);

View File

@ -2,6 +2,8 @@
require('classtool'); require('classtool');
function spec() { function spec() {
var util = require('util'); var util = require('util');
var RpcClient = require('bitcore/RpcClient').class(); var RpcClient = require('bitcore/RpcClient').class();
@ -12,6 +14,9 @@ function spec() {
var Sync = require('./Sync').class(); var Sync = require('./Sync').class();
var sockets = require('../app/controllers/socket.js'); var sockets = require('../app/controllers/socket.js');
var BAD_GEN_ERROR = 'Bad genesis block. Network mismatch between Insight and bitcoind? Insight is configured for:';
function HistoricSync(opts) { function HistoricSync(opts) {
this.network = config.network === 'testnet' ? networks.testnet: networks.livenet; this.network = config.network === 'testnet' ? networks.testnet: networks.livenet;
@ -22,7 +27,12 @@ function spec() {
//available status: new / syncing / finished / aborted //available status: new / syncing / finished / aborted
this.status = 'new'; this.status = 'new';
this.syncInfo = {}; this.error = null;
this.syncPercentage = 0;
this.syncedBlocks = 0;
this.skippedBlocks = 0;
} }
function p() { function p() {
@ -34,6 +44,13 @@ function spec() {
console.log.apply(this, args); console.log.apply(this, args);
} }
HistoricSync.prototype.setError = function(err) {
var self = this;
self.error = err.toString();
self.status='error';
self.showProgress();
};
HistoricSync.prototype.init = function(opts, cb) { HistoricSync.prototype.init = function(opts, cb) {
var self = this; var self = this;
@ -41,17 +58,15 @@ function spec() {
self.opts = opts; self.opts = opts;
self.sync.init(opts, function(err) { self.sync.init(opts, function(err) {
if (err) { if (err) {
self.err = err.message; self.setError(err);
self.syncInfo = util._extend(self.syncInfo, { error: err.message });
return cb(err); return cb(err);
} }
else { else {
// check testnet? // check testnet?
self.rpc.getBlockHash(0, function(err, res){ self.rpc.getBlockHash(0, function(err, res){
if (!err && ( res && res.result !== self.genesis)) { if (!err && ( res && res.result !== self.genesis)) {
self.err = 'Bad genesis block. Network mismatch between Insight and bitcoind? Insight is configured for:' + config.network; err = new Error(BAD_GEN_ERROR + config.network);
err = new Error(self.err); self.setError(err);
self.syncInfo = util._extend(self.syncInfo, { error: err.message });
} }
return cb(err); return cb(err);
}); });
@ -64,14 +79,29 @@ function spec() {
this.sync.close(); this.sync.close();
}; };
HistoricSync.prototype.info = function() {
return {
status: this.status,
blockChainHeight: this.blockChainHeight,
syncPercentage: this.syncPercentage,
skippedBlocks: this.skippedBlocks,
syncedBlocks: this.syncedBlocks,
};
};
HistoricSync.prototype.showProgress = function() { HistoricSync.prototype.showProgress = function() {
var self = this; var self = this;
var i = self.syncInfo; if (self.error) {
var per = parseInt(100 * i.syncedBlocks / i.blocksToSync); p('ERROR:' + self.error);
p(util.format('status: %d/%d [%d%%]', i.syncedBlocks, i.blocksToSync, per)); }
else {
self.syncPercentage = parseFloat(100 * self.syncedBlocks / self.blockChainHeight).toFixed(3);
p(util.format('status: [%d%%] skipped: %d', self.syncPercentage, self.skippedBlocks));
}
if (self.opts.shouldBroadcast) { if (self.opts.shouldBroadcast) {
sockets.broadcastSyncInfo(self.syncInfo); sockets.broadcastSyncInfo(self.info());
} }
}; };
@ -105,17 +135,10 @@ function spec() {
}, },
//show some (inacurate) status //show some (inacurate) status
function(c) { function(c) {
if (!self.step) { if ( ( self.syncedBlocks + self.skippedBlocks) % self.step === 1) {
var step = parseInt(self.syncInfo.blocksToSync / 100);
if (self.opts.progressStep) {
step = self.opts.progressStep;
}
if (step < 2) step = 2;
self.step = step;
}
if (self.syncInfo.syncedBlocks % self.step === 1) {
self.showProgress(); self.showProgress();
} }
return c(); return c();
}, },
//get Info from RPC //get Info from RPC
@ -154,57 +177,49 @@ function spec() {
], function(err) { ], function(err) {
if (err) { if (err) {
self.err = util.format('ERROR: @%s: %s [count: syncedBlocks: %d]', blockHash, err, self.syncInfo.syncedBlocks); self.err = util.format('ERROR: @%s: %s [count: syncedBlocks: %d]', blockHash, err, self.syncedBlocks);
self.status = 'aborted'; self.status = 'aborted';
self.showProgress();
p(self.err); p(self.err);
} }
else { else {
self.err = null; self.err = null;
self.status = 'syncing'; self.status = 'syncing';
} }
if (opts.upToExisting && existed) { if ( (opts.upToExisting && existed && self.syncedBlocks >= self.blockChainHeight) ||
var diff = self.syncInfo.blocksToSync - self.syncInfo.syncedBlocks; (blockEnd && blockEnd === blockHash)) {
if (diff <= 0) {
self.status = 'finished'; self.status = 'finished';
p('DONE. Found existing block: ', blockHash); p('DONE. Found existing block: ', blockHash);
self.showProgress();
return cb(err); return cb(err);
}
else {
self.syncInfo.skipped_blocks = self.syncInfo.skipped_blocks || 1;
if ((self.syncInfo.skipped_blocks++ % 1000) === 1) {
p('WARN found target block\n\tbut blockChain Height is still higher that ours. Previous light sync must be interrupted.\n\tWill keep syncing.', self.syncInfo.syncedBlocks, self.syncInfo.blocksToSync, self.syncInfo.skipped_blocks);
}
}
}
if (blockEnd && blockEnd === blockHash) {
self.status = 'finished';
p('DONE. Found END block: ', blockHash);
return cb(err);
} }
// Continue // Continue
if (blockInfo && blockInfo.result) { if (blockInfo && blockInfo.result) {
if (!existed) self.syncInfo.syncedBlocks++;
if (opts.prev && blockInfo.result.previousblockhash) {
return self.getPrevNextBlock(blockInfo.result.previousblockhash, blockEnd, opts, cb);
}
if (opts.next && blockInfo.result.nextblockhash) return self.getPrevNextBlock(blockInfo.result.nextblockhash, blockEnd, opts, cb); if (existed)
self.skippedBlocks++;
else
self.syncedBlocks++;
// recursion
if (opts.prev && blockInfo.result.previousblockhash)
return self.getPrevNextBlock(blockInfo.result.previousblockhash, blockEnd, opts, cb);
if (opts.next && blockInfo.result.nextblockhash)
return self.getPrevNextBlock(blockInfo.result.nextblockhash, blockEnd, opts, cb);
} }
return cb(err); return cb(err);
}); });
}; };
HistoricSync.prototype.import_history = function(opts, next) { HistoricSync.prototype.importHistory = function(opts, next) {
var self = this; var self = this;
var retry_secs = 2; var retry_secs = 2;
var bestBlock; var bestBlock;
var blockChainHeight;
async.series([ async.series([
function(cb) { function(cb) {
@ -220,14 +235,14 @@ function spec() {
self.rpc.getBlockCount(function(err, res) { self.rpc.getBlockCount(function(err, res) {
if (err) return cb(err); if (err) return cb(err);
blockChainHeight = res.result; self.blockChainHeight = res.result;
return cb(); return cb();
}); });
}, },
function(cb) { function(cb) {
if (!opts.reverse) return cb(); if (!opts.reverse) return cb();
self.rpc.getBlockHash(blockChainHeight, function(err, res) { self.rpc.getBlockHash(self.blockChainHeight, function(err, res) {
if (err) return cb(err); if (err) return cb(err);
bestBlock = res.result; bestBlock = res.result;
@ -236,15 +251,8 @@ function spec() {
}); });
}, },
function(cb) { function(cb) {
// This is only to inform progress. if (opts.upToExisting) {
if (!opts.upToExisting) {
self.rpc.getInfo(function(err, res) {
if (err) return cb(err);
self.syncInfo.blocksToSync = res.result.blocks;
return cb();
});
}
else {
// should be isOrphan = true or null to be more accurate. // should be isOrphan = true or null to be more accurate.
Block.count({ Block.count({
isOrphan: null isOrphan: null
@ -252,14 +260,12 @@ function spec() {
function(err, count) { function(err, count) {
if (err) return cb(err); if (err) return cb(err);
self.syncInfo.blocksToSync = blockChainHeight - count; self.syncedBlocks = count || 0;
if (self.syncInfo.blocksToSync < 1) self.syncInfo.blocksToSync = 1;
return cb(); return cb();
}); });
} }
}, },
], function(err) { ], function(err) {
var start, end; var start, end;
function sync() { function sync() {
if (opts.reverse) { if (opts.reverse) {
@ -272,18 +278,6 @@ function spec() {
end = null; end = null;
opts.next = true; opts.next = true;
} }
self.syncInfo = util._extend(self.syncInfo, {
start: start,
isStartGenesis: start === self.genesis,
end: end,
isEndGenesis: end === self.genesis,
scanningForward: opts.next,
scanningBackward: opts.prev,
upToExisting: opts.upToExisting,
syncedBlocks: 0,
});
p('Starting from: ', start); p('Starting from: ', start);
p(' to : ', end); p(' to : ', end);
p(' opts: ', JSON.stringify(opts)); p(' opts: ', JSON.stringify(opts));
@ -300,10 +294,20 @@ function spec() {
}); });
} }
if (!self.step) {
var step = parseInt( (self.blockChainHeight - self.syncedBlocks) / 1000);
if (self.opts.progressStep) {
step = self.opts.progressStep;
}
if (step < 10) step = 10;
self.step = step;
}
if (err) { if (err) {
self.syncInfo = util._extend(self.syncInfo, { self.setError(err);
error: err.message
});
return next(err, 0); return next(err, 0);
} }
else { else {
@ -313,7 +317,7 @@ function spec() {
}; };
// upto if we have genesis block? // upto if we have genesis block?
HistoricSync.prototype.smart_import = function(next) { HistoricSync.prototype.smartImport = function(next) {
var self = this; var self = this;
Block.findOne({ Block.findOne({
@ -335,7 +339,7 @@ function spec() {
upToExisting: b ? true: false, upToExisting: b ? true: false,
}; };
return self.import_history(opts, next); return self.importHistory(opts, next);
}); });
}; };

View File

@ -224,6 +224,10 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
margin-bottom: 45px; margin-bottom: 45px;
} }
.progress-bar-info {
background-color: #8DC429;
}
/* Set the fixed height of the footer here */ /* Set the fixed height of the footer here */
#footer { #footer {
height: 51px; height: 51px;
@ -368,4 +372,21 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
font-size: 80%; font-size: 80%;
} }
.status .t {
color: white;
display: inline-block;
padding:0px 5px;
}
.status .text-danger {
background: red;
}
.status .text-warning {
background: yellow;
color: black;
}
.status .text-default {
}

View File

@ -23,39 +23,23 @@ function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, get_
}; };
var on_sync_update = function(sync) { var on_sync_update = function(sync) {
if (sync.error) {
$rootScope.syncError = sync.error;
return;
}
if (sync.blocksToSync > sync.syncedBlocks) {
var p = parseInt(100*(sync.syncedBlocks) / sync.blocksToSync);
var delta = sync.blocksToSync - sync.syncedBlocks;
sync.message = 'Sync ' + p + '% ['+delta+' blocks remaining]';
sync.style = 'warn';
} else {
sync.message = 'On sync';
sync.style = 'success';
}
sync.tooltip = 'Synced blocks: '+sync.syncedBlocks;
$scope.sync = sync; $scope.sync = sync;
}; };
$scope.getSync = function() { $scope.getSync = function() {
Sync.get({}, Sync.get({},
function(sync) { function(sync) {
$rootScope.syncError = null;
on_sync_update(sync); on_sync_update(sync);
}, },
function(e) { function(e) {
$rootScope.syncError = 'Could not get sync information' + e; $scope.sync = { error: 'Could not get sync information' + e };
}); });
}; };
var socket = get_socket($scope); var socket = get_socket($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!');
on_sync_update(sync); on_sync_update(sync);
}); });

View File

@ -25,8 +25,9 @@
</div> </div>
<div class="status" data-ng-controller="StatusController"> <div class="status" data-ng-controller="StatusController">
<span data-ng-init="getSync()"> <span data-ng-init="getSync()">
<span class="small" tooltip="{{sync.tooltip}}" tooltip-placement="down"> <div class="t text-danger" data-ng-show="sync.error" tooltip="{{sync.error}}" tooltip-placement="bottom"> ERROR </div>
<i class="{{sync.style}}"><strong> {{sync.message}} </strong></i> <div class="t text-warning " tooltip="{{sync.syncedBlocks}} / {{sync.blockChainHeight}} synced. {{sync.skippedBlocks}} skipped" tooltip-placement="bottom" data-ng-show="sync.status==='syncing'"> {{sync.status}} {{sync.syncPercentage}}%</div>
<div class="t text-default" tooltip="historic sync finished" tooltip-placement="bottom" data-ng-show="sync.status==='finished'"> On sync</div>
</span> </span>
</span> </span>
<span data-ng-init="getStatus('Info')"> <span data-ng-init="getStatus('Info')">

View File

@ -4,76 +4,11 @@
Application Status Application Status
</h1> </h1>
</div> </div>
<div class="row"> <div id="status" class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-9">
<h2>Bitcoin node information</h2>
<table class="table table-striped" data-ng-init="getStatus('Info')">
<tbody>
<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>
<td>Version</td>
<td>{{info.version}}</td>
</tr>
<tr>
<td>Protocol version</td>
<td>{{info.protocolversion}}</td>
</tr>
<tr>
<td>Wallet version</td>
<td>{{info.walletversion}}</td>
</tr>
<tr>
<td>Balance (BTC)</td>
<td>{{info.balance}}</td>
</tr>
<tr>
<td>Blocks</td>
<td><a href="/#!/block-index/{{info.blocks}}">{{info.blocks}}</a></td>
</tr>
<tr>
<td>Time Offset</td>
<td>{{info.timeoffset}}</td>
</tr>
<tr>
<td>Connections to other nodes</td>
<td>{{info.connections}}</td>
</tr>
<tr>
<td>Proxy setting</td>
<td>{{info.proxy}}</td>
</tr>
<tr>
<td>Mining Difficulty</td>
<td>{{info.difficulty}}</td>
</tr>
<tr>
<td>Testnet</td>
<td>{{info.testnet}}</td>
</tr>
<tr>
<td>Keypool Oldest Date</td>
<td>{{info.keypoololdest*1000 | date:'medium' }}</td>
</tr>
<tr>
<td>Keypool Size</td>
<td>{{info.keypoolsize}}</td>
</tr>
<tr>
<td>Default Transaction Fee (BTC)</td>
<td>{{info.paytxfee}}</td>
</tr>
<tr>
<td>Info Errors</td>
<td>{{info.infoErrors}}</td>
</tr>
</tbody>
</table>
<h2>Sync Status</h2> <h4>Sync Status</h4>
<table class="table table-striped" data-ng-init="getSync()"> <table class="table" data-ng-init="getSync()">
<tbody> <tbody>
<tr data-ng-show="syncError"> <tr data-ng-show="syncError">
<td colspan="2"> <span class="text-danger"> {{ syncError }} </span> <td colspan="2"> <span class="text-danger"> {{ syncError }} </span>
@ -91,29 +26,29 @@
</tr> </tr>
<tr> <tr>
<td>Blocks to Sync</td> <td>Blocks to Sync</td>
<td>{{sync.blocksToSync}}</td> <td class="text-right">{{sync.blocksToSync}}</td>
</tr> </tr>
<tr> <tr>
<td>Synced Blocks</td> <td>Synced Blocks</td>
<td>{{sync.syncedBlocks}}</td> <td class="text-right">{{sync.syncedBlocks}}</td>
</tr> </tr>
<tr> <tr>
<td>Start</td> <td>Start</td>
<td> <td class="text-right">
<a href="/#!/block/{{sync.start}}">{{sync.start}}</a> <a href="/#!/block/{{sync.start}}">{{sync.start}}</a>
<span data-ng-show="sync.isStartGenesis"> (genesisBlock)</span> <span data-ng-show="sync.isStartGenesis"> (genesisBlock)</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>End</td> <td>End</td>
<td> <td class="text-right">
<a href="/#!/block/{{sync.end}}">{{sync.end}}</a> <a href="/#!/block/{{sync.end}}">{{sync.end}}</a>
<span data-ng-show="sync.isEndGenesis"> (genesisBlock)</span> <span data-ng-show="sync.isEndGenesis"> (genesisBlock)</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Sync properties</td> <td>Sync properties</td>
<td> <td class="text-right">
<ul> <ul>
<li data-ng-show="sync.upToExisting"> <span> Stops at existing block </span> <li data-ng-show="sync.upToExisting"> <span> Stops at existing block </span>
<li> <li>
@ -125,8 +60,8 @@
</tbody> </tbody>
</table> </table>
<h2>Transaction Output Set Information</h2> <h4>Transaction Output Set Information</h4>
<table class="table table-striped" data-ng-init="getStatus('TxOutSetInfo')"> <table class="table" data-ng-init="getStatus('TxOutSetInfo')">
<tbody> <tbody>
<tr data-ng-show="!txoutsetinfo &amp;&amp; !infoError"> <tr data-ng-show="!txoutsetinfo &amp;&amp; !infoError">
<td colspan="2" class="text-center">Loading...</td> <td colspan="2" class="text-center">Loading...</td>
@ -136,54 +71,37 @@
</tr> </tr>
<tr> <tr>
<td>Height</td> <td>Height</td>
<td><a href="/#!/block-index/{{txoutsetinfo.height}}">{{txoutsetinfo.height}}</a></td> <td class="text-right"><a href="/#!/block-index/{{txoutsetinfo.height}}">{{txoutsetinfo.height}}</a></td>
</tr> </tr>
<tr> <tr>
<td>Best Block</td> <td>Best Block</td>
<td><a href="/#!/block/{{txoutsetinfo.bestblock}}">{{txoutsetinfo.bestblock}}</a></td> <td class="text-right"><a href="/#!/block/{{txoutsetinfo.bestblock}}">{{txoutsetinfo.bestblock}}</a></td>
</tr> </tr>
<tr> <tr>
<td>Transactions</td> <td>Transactions</td>
<td>{{txoutsetinfo.transactions}}</td> <td class="text-right"> {{txoutsetinfo.transactions}}</td>
</tr> </tr>
<tr> <tr>
<td>Transaction Outputs</td> <td>Transaction Outputs</td>
<td>{{txoutsetinfo.txouts}}</td> <td class="text-right">{{txoutsetinfo.txouts}}</td>
</tr> </tr>
<tr> <tr>
<td>Bytes Serialized</td> <td>Bytes Serialized</td>
<td>{{txoutsetinfo.bytes_serialized}}</td> <td class="text-right">{{txoutsetinfo.bytes_serialized}}</td>
</tr> </tr>
<tr> <tr>
<td>Hash Serialized</td> <td>Hash Serialized</td>
<td>{{txoutsetinfo.hash_serialized}}</td> <td class="text-right">{{txoutsetinfo.hash_serialized}}</td>
</tr> </tr>
<tr> <tr>
<td>Total Amount</td> <td>Total Amount</td>
<td>{{txoutsetinfo.total_amount}}</td> <td class="text-right">{{txoutsetinfo.total_amount}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h2>Difficulty</h2> <h4>Last Block</h4>
<table class="table table-striped" data-ng-init="getStatus('Difficulty')"> <table class="table" data-ng-init="getStatus('LastBlockHash')">
<tbody>
<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>
<td>Mining Difficulty</td>
<td>{{difficulty}}</td>
</tr>
</tbody>
</table>
<h2>Last Block</h2>
<table class="table table-striped" data-ng-init="getStatus('LastBlockHash')">
<tbody> <tbody>
<tr data-ng-show="!lastblockhash &amp;&amp; !infoError"> <tr data-ng-show="!lastblockhash &amp;&amp; !infoError">
<td colspan="2" class="text-center">Loading...</td> <td colspan="2" class="text-center">Loading...</td>
@ -193,11 +111,98 @@
</tr> </tr>
<tr> <tr>
<td>Last block hash</td> <td>Last block hash</td>
<td><a href="/#!/block/{{lastblockhash}}">{{lastblockhash}}</a></td> <td class="text-right"><a href="/#!/block/{{lastblockhash}}">{{lastblockhash}}</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div> <!-- END OF COL-8 -->
<div class="col-md-3">
<div class="col-gray">
<h4>Bitcoin node information</h4>
<table class="table" data-ng-init="getStatus('Info')">
<tbody>
<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>
<td>Version</td>
<td class="text-right">{{info.version}}</td>
</tr>
<tr>
<td>Protocol version</td>
<td class="text-right">{{info.protocolversion}}</td>
</tr>
<tr>
<td>Wallet version</td>
<td class="text-right">{{info.walletversion}}</td>
</tr>
<tr>
<td>Balance (BTC)</td>
<td class="text-right">{{info.balance}}</td>
</tr>
<tr>
<td>Blocks</td>
<td class="text-right"><a href="/#!/block-index/{{info.blocks}}">{{info.blocks}}</a></td>
</tr>
<tr>
<td>Time Offset</td>
<td class="text-right">{{info.timeoffset}}</td>
</tr>
<tr>
<td>Connections to other nodes</td>
<td class="text-right">{{info.connections}}</td>
</tr>
<tr>
<td>Proxy setting</td>
<td class="text-right">{{info.proxy}}</td>
</tr>
<tr>
<td>Mining Difficulty</td>
<td class="text-right">{{info.difficulty}}</td>
</tr>
<tr>
<td>Testnet</td>
<td class="text-right">{{info.testnet}}</td>
</tr>
<tr>
<td>Keypool Oldest Date</td>
<td class="text-right">{{info.keypoololdest*1000 | date:'medium' }}</td>
</tr>
<tr>
<td>Keypool Size</td>
<td class="text-right">{{info.keypoolsize}}</td>
</tr>
<tr>
<td>Default Transaction Fee (BTC)</td>
<td class="text-right">{{info.paytxfee}}</td>
</tr>
<tr>
<td>Info Errors</td>
<td class="text-right">{{info.infoErrors}}</td>
</tr>
</tbody>
</table>
<h4>Difficulty</h4>
<table class="table" data-ng-init="getStatus('Difficulty')">
<tbody>
<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>
<td>Mining Difficulty</td>
<td>{{difficulty}}</td>
</tr>
</tbody>
</table>
</div> <!-- END OF COL-GRAY -->
</div> <!-- END OF COL-3 -->
</div> </div>
</section> </section>

View File

@ -55,8 +55,11 @@ walk(models_path);
// historic_sync process // historic_sync process
var historicSync = {}; var historicSync = {};
if (!config.disableHistoricSync) { if (!config.disableHistoricSync) {
historicSync = new HistoricSync(); historicSync = new HistoricSync();
historicSync.init({ historicSync.init({
skipDbConnection: true, skipDbConnection: true,
shouldBroadcast: true, shouldBroadcast: true,
@ -68,11 +71,11 @@ if (!config.disableHistoricSync) {
console.log('[historic_sync] ' + txt); console.log('[historic_sync] ' + txt);
} }
else { else {
historicSync.smart_import(function(err){ historicSync.smartImport(function(err){
var txt= 'ended.'; var txt= 'ended.';
if (err) txt = 'ABORTED with error: ' + err.message; if (err) txt = 'ABORTED with error: ' + err.message;
console.log('[historic_sync] ' + txt, historicSync.syncInfo); console.log('[historic_sync] ' + txt, historicSync.info());
}); });
} }
}); });

View File

@ -33,10 +33,10 @@ async.series([
}, },
function(cb) { function(cb) {
if (program.smart) { if (program.smart) {
historicSync.smart_import(cb); historicSync.smartImport(cb);
} }
else { else {
historicSync.import_history({ historicSync.importHistory({
destroy: program.destroy, destroy: program.destroy,
reverse: program.reverse, reverse: program.reverse,
upToExisting: program.uptoexisting, upToExisting: program.uptoexisting,
@ -50,7 +50,7 @@ async.series([
console.log('CRITICAL ERROR: ', err); console.log('CRITICAL ERROR: ', err);
} }
else { else {
console.log('Finished.\n Status:\n', historicSync.syncInfo); console.log('Finished.\n Status:\n', historicSync.info());
} }
}); });