add c++ version of base58 to faster sync
This commit is contained in:
parent
c612857295
commit
3db0ac8615
|
@ -47,6 +47,29 @@ function spec() {
|
||||||
console.log.apply(this, args);
|
console.log.apply(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HistoricSync.prototype.showProgress = function() {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
if ( self.status ==='syncing' &&
|
||||||
|
( self.syncedBlocks ) % self.step !== 1) return;
|
||||||
|
|
||||||
|
if (self.error) {
|
||||||
|
p('ERROR: ' + self.error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.updatePercentage();
|
||||||
|
p(util.format('status: [%d%%]', self.syncPercentage));
|
||||||
|
}
|
||||||
|
if (self.opts.shouldBroadcastSync) {
|
||||||
|
sockets.broadcastSyncInfo(self.info());
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (self.syncPercentage > 10) {
|
||||||
|
// process.exit(-1);
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
HistoricSync.prototype.setError = function(err) {
|
HistoricSync.prototype.setError = function(err) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.error = err.toString();
|
self.error = err.toString();
|
||||||
|
@ -107,28 +130,6 @@ function spec() {
|
||||||
if (this.syncPercentage > 100) this.syncPercentage = 100;
|
if (this.syncPercentage > 100) this.syncPercentage = 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
HistoricSync.prototype.showProgress = function() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if ( self.status ==='syncing' &&
|
|
||||||
( self.syncedBlocks ) % self.step !== 1) return;
|
|
||||||
|
|
||||||
if (self.error) {
|
|
||||||
p('ERROR: ' + self.error);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
self.updatePercentage();
|
|
||||||
p(util.format('status: [%d%%]', self.syncPercentage));
|
|
||||||
}
|
|
||||||
if (self.opts.shouldBroadcastSync) {
|
|
||||||
sockets.broadcastSyncInfo(self.info());
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// if (self.syncPercentage > 10) {
|
|
||||||
// process.exit(-1);
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
HistoricSync.prototype.getPrevNextBlock = function(blockHash, blockEnd, scanOpts, cb) {
|
HistoricSync.prototype.getPrevNextBlock = function(blockHash, blockEnd, scanOpts, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
@ -220,7 +221,7 @@ function spec() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//var a=1;
|
||||||
HistoricSync.prototype.getBlockFromFile = function(cb) {
|
HistoricSync.prototype.getBlockFromFile = function(cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
@ -228,6 +229,8 @@ function spec() {
|
||||||
|
|
||||||
//get Info
|
//get Info
|
||||||
self.blockExtractor.getNextBlock(function(err, b) {
|
self.blockExtractor.getNextBlock(function(err, b) {
|
||||||
|
// a++;
|
||||||
|
//return cb(null,{previousblockhash:a.toString(), hash:(a-1).toString() });
|
||||||
if (err || ! b) return cb(err);
|
if (err || ! b) return cb(err);
|
||||||
blockInfo = b.getStandardizedObject(b.txs, self.network);
|
blockInfo = b.getStandardizedObject(b.txs, self.network);
|
||||||
// blockInfo.curWork = Deserialize.intFromCompact(b.bits);
|
// blockInfo.curWork = Deserialize.intFromCompact(b.bits);
|
||||||
|
|
|
@ -7,7 +7,12 @@ function spec() {
|
||||||
var sockets = require('../app/controllers/socket.js');
|
var sockets = require('../app/controllers/socket.js');
|
||||||
var BlockDb = require('./BlockDb').class();
|
var BlockDb = require('./BlockDb').class();
|
||||||
var bitutil = require('bitcore/util/util');
|
var bitutil = require('bitcore/util/util');
|
||||||
var Address = require('bitcore/Address').class();
|
|
||||||
|
// This is 0.1.2 => c++ version of base57-native
|
||||||
|
var base58 = require('base58-native');
|
||||||
|
var encodedData = require('bitcore/util/EncodedData').class({base58: base58});
|
||||||
|
var versionedData = require('bitcore/util/VersionedData').class({superclass: encodedData});
|
||||||
|
var Address = require('bitcore/Address').class({superclass: versionedData});
|
||||||
var TransactionDb = require('./TransactionDb').class();
|
var TransactionDb = require('./TransactionDb').class();
|
||||||
var config = require('../config/config');
|
var config = require('../config/config');
|
||||||
var networks = require('bitcore/networks');
|
var networks = require('bitcore/networks');
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
"postinstall": "node node_modules/bower/bin/bower install; node ./node_modules/grunt-cli/bin/grunt compile "
|
"postinstall": "node node_modules/bower/bin/bower install; node ./node_modules/grunt-cli/bin/grunt compile "
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"base58-native": "0.1.2",
|
||||||
"async": "*",
|
"async": "*",
|
||||||
"leveldown": "*",
|
"leveldown": "*",
|
||||||
"levelup": "*",
|
"levelup": "*",
|
||||||
|
|
Loading…
Reference in New Issue