improve logging on Sync
This commit is contained in:
parent
7a24d3bcd8
commit
8de655eb2b
10
lib/Sync.js
10
lib/Sync.js
@ -86,10 +86,10 @@ Sync.prototype.storeTipBlock = function(b, allowReorgs, cb) {
|
||||
var self = this;
|
||||
|
||||
if ( self.storingBlock ) {
|
||||
console.log('## Storing a block already. Delaying storeTipBlock with:' +
|
||||
logger.debug('Storing a block already. Delaying storeTipBlock with:' +
|
||||
b.hash);
|
||||
return setTimeout( function() {
|
||||
console.log('## Retrying storeTipBlock with: ' + b.hash);
|
||||
logger.debug('Retrying storeTipBlock with: ' + b.hash);
|
||||
self.storeTipBlock(b,allowReorgs,cb);
|
||||
}, 1000);
|
||||
}
|
||||
@ -123,7 +123,7 @@ Sync.prototype.storeTipBlock = function(b, allowReorgs, cb) {
|
||||
oldHeight = hash ? (h || 0) : -1
|
||||
if (oldTip && newPrev !== oldTip) {
|
||||
needReorg = true;
|
||||
console.log('## REORG Triggered, tip mismatch');
|
||||
logger.debug('REORG Triggered, tip mismatch');
|
||||
}
|
||||
return c();
|
||||
});
|
||||
@ -195,7 +195,7 @@ Sync.prototype.processReorg = function(oldTip, oldNext, newPrev, oldHeight, cb)
|
||||
if (height<0) return c();
|
||||
|
||||
newHeight = height + 1;
|
||||
info('# Reorg Case 1) OldNext: %s NewHeight: %d', oldNext, newHeight);
|
||||
info('Reorg Case 1) OldNext: %s NewHeight: %d', oldNext, newHeight);
|
||||
orphanizeFrom = oldNext;
|
||||
return c(err);
|
||||
});
|
||||
@ -203,7 +203,7 @@ Sync.prototype.processReorg = function(oldTip, oldNext, newPrev, oldHeight, cb)
|
||||
function(c) {
|
||||
if (orphanizeFrom) return c();
|
||||
|
||||
info('# Reorg Case 2)');
|
||||
info('Reorg Case 2)');
|
||||
self.setBranchConnectedBackwards(newPrev, function(err, yHash, newYHashNext, height) {
|
||||
if (err) return c(err);
|
||||
newHeight = height;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user