diff --git a/lib/HistoricSync.js b/lib/HistoricSync.js index 408f8370..32f224d1 100644 --- a/lib/HistoricSync.js +++ b/lib/HistoricSync.js @@ -91,6 +91,9 @@ function spec() { return cb(err); } else { + + self.startTs = parseInt(Date.now()/1000); + // check testnet? self.rpc.getBlockHash(0, function(err, res){ if (!err && ( res && res.result !== self.genesis)) { @@ -121,6 +124,8 @@ function spec() { syncTipHash: this.sync.tip, error: this.error, type: this.type, + startTs: this.startTs, + endTs: this.endTs, }; }; @@ -199,6 +204,8 @@ function spec() { } if ( self.found && self.syncedBlocks >= self.blockChainHeight ) { + + self.endTs = parseInt(Date.now()/1000); self.status = 'finished'; p('DONE. Height: ' , self.syncedBlocks); return cb(err); @@ -290,8 +297,11 @@ function spec() { if (blockInfo && blockInfo.hash) { self.syncedBlocks++; - } else + } + else { + self.endTs = parseInt(Date.now()/1000); self.status = 'finished'; + } return cb(err); });