From b430742aa8717045ddb4a792d75f3e76363f639d Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 14 Feb 2014 09:57:29 -0300 Subject: [PATCH] add endTs to status --- lib/HistoricSync.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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); });