tools: delete gossip_store of needed for downgrade even if db hasn't changed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -80,7 +80,7 @@ def test_downgrade(node_factory, executor):
|
||||
l1.daemon.executable = current_executable
|
||||
|
||||
# Another downgrade is a noop.
|
||||
assert subprocess.check_output(cmd_line).decode("utf8").startswith("Already compatible with ")
|
||||
assert "Already compatible with " in subprocess.check_output(cmd_line).decode("utf8")
|
||||
|
||||
# Should be able to upgrade without any trouble
|
||||
l1.daemon.opts['database-upgrade'] = True
|
||||
|
||||
@@ -239,6 +239,12 @@ int main(int argc, char *argv[])
|
||||
migrations = get_db_migrations(&num_migrations);
|
||||
prev_version = version_db(PREV_VERSION);
|
||||
|
||||
/* Do this even if the db hasn't changed. */
|
||||
if (!version_db(PREV_VERSION)->gossip_store_compatible) {
|
||||
printf("Deleting incompatible gossip_store\n");
|
||||
unlink(path_join(tmpctx, net_dir, "gossip_store"));
|
||||
}
|
||||
|
||||
/* Open db, check it's the expected version */
|
||||
db = db_open(tmpctx, wallet_dsn, false, false, db_error, NULL);
|
||||
if (!db)
|
||||
@@ -290,11 +296,6 @@ int main(int argc, char *argv[])
|
||||
printf("Downgrade to %s succeeded. Committing.\n", PREV_VERSION);
|
||||
db_commit_transaction(db);
|
||||
tal_free(db);
|
||||
|
||||
if (!version_db(PREV_VERSION)->gossip_store_compatible) {
|
||||
printf("Deleting incompatible gossip_store\n");
|
||||
unlink(path_join(tmpctx, net_dir, "gossip_store"));
|
||||
}
|
||||
}
|
||||
|
||||
/*** We don't actually perform migrations, so these are stubs which abort. ***/
|
||||
|
||||
Reference in New Issue
Block a user