uptoexisting -> to to tip block

This commit is contained in:
Matias Alejo Garcia 2014-02-12 23:37:01 -03:00
parent a35fcc776d
commit 6cef1eaec3
1 changed files with 13 additions and 2 deletions

View File

@ -320,6 +320,7 @@ function spec() {
var self = this;
var lastBlock;
var tip;
async.series([
function(cb) {
@ -333,7 +334,6 @@ function spec() {
function (cb) { return self.getBlockCount(cb); },
function(cb) {
if (!scanOpts.reverse) return cb();
self.rpc.getBlockHash(self.blockChainHeight, function(err, res) {
if (err) return cb(err);
lastBlock = res.result;
@ -341,6 +341,17 @@ function spec() {
return cb();
});
},
function(cb) {
if (!scanOpts.reverse) return cb();
self.sync.bDb.getTip(function(err, res) {
if (err) return cb(err);
tip = res;
console.log('Old Tip:', tip);
return cb();
});
},
function(cb) {
if (scanOpts.upToExisting) {
// should be isOrphan = true or null to be more accurate.
@ -378,7 +389,7 @@ function spec() {
if (scanOpts.reverse) {
start = lastBlock;
end = self.genesis;
end = tip || self.genesis;
scanOpts.prev = true;
}
else {