check range for search.

This commit is contained in:
Christopher Jeffrey 2016-01-21 04:22:15 -08:00
parent 34a44fe391
commit 8f3667b866

View File

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