migrate: check tip index for chaindbv2.
This commit is contained in:
parent
8b8e1e3f13
commit
75f01c1692
@ -64,6 +64,26 @@ var updateVersion = co(function* updateVersion() {
|
|||||||
batch.put('V', ver);
|
batch.put('V', ver);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var checkTipIndex = co(function* checkTipIndex() {
|
||||||
|
var iter, item;
|
||||||
|
|
||||||
|
iter = db.iterator({
|
||||||
|
gte: pair('p', constants.ZERO_HASH),
|
||||||
|
lte: pair('p', constants.MAX_HASH)
|
||||||
|
});
|
||||||
|
|
||||||
|
item = yield iter.next();
|
||||||
|
|
||||||
|
if (!item) {
|
||||||
|
console.log('No tip index found.');
|
||||||
|
console.log('Please run migrate/ensure-tip-index.js first!');
|
||||||
|
process.exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield iter.end();
|
||||||
|
});
|
||||||
|
|
||||||
var updateOptions = co(function* updateOptions() {
|
var updateOptions = co(function* updateOptions() {
|
||||||
if (yield db.has('O'))
|
if (yield db.has('O'))
|
||||||
return;
|
return;
|
||||||
@ -202,6 +222,7 @@ co.spawn(function* () {
|
|||||||
console.log('Opened %s.', file);
|
console.log('Opened %s.', file);
|
||||||
batch = db.batch();
|
batch = db.batch();
|
||||||
yield updateVersion();
|
yield updateVersion();
|
||||||
|
yield checkTipIndex();
|
||||||
yield updateOptions();
|
yield updateOptions();
|
||||||
yield updateDeployments();
|
yield updateDeployments();
|
||||||
yield reserializeCoins();
|
yield reserializeCoins();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user