From 2c37e05ff7a77ac577f0fd603ac607086057c796 Mon Sep 17 00:00:00 2001 From: tripathyr Date: Tue, 25 May 2021 11:01:31 +0530 Subject: [PATCH] Added test to check header.height --- lib/services/block/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/services/block/index.js b/lib/services/block/index.js index 73ad6be8..ba6a1aac 100644 --- a/lib/services/block/index.js +++ b/lib/services/block/index.js @@ -725,12 +725,12 @@ BlockService.prototype._findLatestValidBlockHeader = function(callback) { log.error('Block Service: we could not locate any of our recent block hashes in the header service ' + 'index. Perhaps our header service sync\'ed to the wrong chain?'); } // assert(header, 'Block Service: we could not locate any of our recent block hashes in the header service ' + 'index. Perhaps our header service sync\'ed to the wrong chain?'); - - if (header.height > self._tip.height) { - log.error('Block Service: we found a common ancestor header whose ' + 'height was greater than our current tip. This should be impossible.'); - } + if (typeof header.height !== 'undefined') { + if (header.height > self._tip.height) { + log.error('Block Service: we found a common ancestor header whose ' + 'height was greater than our current tip. This should be impossible.'); + } // assert(header.height <= self._tip.height, 'Block Service: we found a common ancestor header whose ' + 'height was greater than our current tip. This should be impossible.'); - + } callback(null, header); });