db should only sync after all services are started
This commit is contained in:
parent
5a372f268c
commit
831bf0b988
@ -161,8 +161,9 @@ DB.prototype.start = function(callback) {
|
|||||||
this.store = levelup(this.dataPath, { db: this.levelupStore, maxOpenFiles: this.maxOpenFiles, keyEncoding: 'binary', valueEncoding: 'binary'});
|
this.store = levelup(this.dataPath, { db: this.levelupStore, maxOpenFiles: this.maxOpenFiles, keyEncoding: 'binary', valueEncoding: 'binary'});
|
||||||
this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));
|
this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));
|
||||||
|
|
||||||
this.once('ready', function() {
|
this.node.once('ready', function() {
|
||||||
log.info('Bitcoin Database Ready');
|
// start syncing
|
||||||
|
self.sync();
|
||||||
|
|
||||||
// Notify that there is a new tip
|
// Notify that there is a new tip
|
||||||
self.node.services.bitcoind.on('tip', function() {
|
self.node.services.bitcoind.on('tip', function() {
|
||||||
@ -188,8 +189,6 @@ DB.prototype.start = function(callback) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sync();
|
|
||||||
self.emit('ready');
|
|
||||||
setImmediate(callback);
|
setImmediate(callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user