Fixed sanity check when block height is zero.
This commit is contained in:
parent
3383771b10
commit
b8e73ae238
@ -310,6 +310,11 @@ BlockService.prototype._resetTip = function(callback) {
|
|||||||
BlockService.prototype._performSanityCheck = function(tip, callback) {
|
BlockService.prototype._performSanityCheck = function(tip, callback) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
if (tip.height === 0) {
|
||||||
|
return callback(null, tip);
|
||||||
|
}
|
||||||
|
|
||||||
// is our tip saved in our database? If not, then find the latest block that is in
|
// is our tip saved in our database? If not, then find the latest block that is in
|
||||||
// in our database and set the tip to that
|
// in our database and set the tip to that
|
||||||
self._getBlock(tip.hash, function(err, block) {
|
self._getBlock(tip.hash, function(err, block) {
|
||||||
@ -383,6 +388,7 @@ BlockService.prototype._queueBlock = function(block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Date.now() - self._timeOfLastBestBlockReport > 30000) { // 30 seconds
|
if (Date.now() - self._timeOfLastBestBlockReport > 30000) { // 30 seconds
|
||||||
|
self._timeOfLastBestBlockReport = Date.now();
|
||||||
log.info('Block Service: The best block hash is: ' + self._tip.hash +
|
log.info('Block Service: The best block hash is: ' + self._tip.hash +
|
||||||
' at height: ' + self._tip.height);
|
' at height: ' + self._tip.height);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user