From 8f3667b8667967c978d45e6c5653b6f2a83f4735 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 21 Jan 2016 04:22:15 -0800 Subject: [PATCH] check range for search. --- lib/bcoin/pool.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 3a267197..699d98ac 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -1214,6 +1214,7 @@ Pool.prototype.search = function search(id, range, e) { // chain by default if (!range.end) range.end = utils.now(); + if (!range.start) range.start = utils.now() - 432000; @@ -1255,14 +1256,11 @@ Pool.prototype.search = function search(id, range, e) { timeout = setTimeout(done.bind(null, true), total); - this.chain.resetTime(range.start); - - this.stopSync(); - - if (this.peers.load) - this.peers.load.destroy(); - - this.startSync(); + if (range.start < this.chain.getTip().ts) { + this.chain.resetTime(range.start); + this.stopSync(); + this.startSync(); + } return e; };