add WARN is db version is old

This commit is contained in:
Matias Alejo Garcia 2014-05-26 15:16:38 -03:00
parent 1bafbd48d0
commit eebc286825
2 changed files with 18 additions and 0 deletions

View File

@ -334,6 +334,15 @@ HistoricSync.prototype.prepareToSync = function(opts, next) {
self.status = 'starting';
async.series([
function(s_c) {
self.sync.txDb.checkVersion02(function(isV02){
if (!isV02) {
console.log('\n#############################\n\n ## Insight API DB is older that v0.2. Please resync using:\n $ util/sync.js -D\n More information at Insight API\'s Readme.md')
process.exit(1);
}
return s_c();
});
},
function(s_c) {
self.checkNetworkSettings(s_c);
},

View File

@ -671,4 +671,13 @@ TransactionDb.prototype.getPoolInfo = function(txid, cb) {
});
};
TransactionDb.prototype.checkVersion02 = function(cb) {
var k = 'txb-f0315ffc38709d70ad5647e22048358dd3745f3ce3874223c80a7c92fab0c8ba-00000000b873e79784647a6c82962c70d228557d24a747ea4d1b8bbe878e1206';
db.get(k, function(err, val) {
return cb(val? false : true);
});
};
module.exports = require('soop')(TransactionDb);