add endTs to status

This commit is contained in:
Matias Alejo Garcia 2014-02-14 09:57:29 -03:00
parent 3db0ac8615
commit b430742aa8
1 changed files with 11 additions and 1 deletions

View File

@ -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);
});