Browse Source

db: add --ignore-dbversion to override database checks.

At your own risk, of course.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
e21b161ed9
  1. 14
      daemon/db.c
  2. 10
      daemon/lightningd.c
  3. 3
      daemon/lightningd.h

14
daemon/db.c

@ -1172,9 +1172,17 @@ static void db_check_version(struct lightningd_state *dstate)
fatal("db_check_version:step gave %s:%s",
sqlite3_errstr(err), sqlite3_errmsg(sql));
ver = sqlite3_column_str(stmt, 0);
if (!streq(ver, VERSION))
fatal("DATABASE NEEDS UPDATE. Version %s does not match %s",
ver, VERSION);
if (!streq(ver, VERSION)) {
if (dstate->config.db_version_ignore)
log_unusual(dstate->base_log,
"DATABASE NEEDS UPDATE."
" Version %s does not match %s",
ver, VERSION);
else
fatal("DATABASE NEEDS UPDATE."
" Version %s does not match %s",
ver, VERSION);
}
}
tal_free(ctx);
}

10
daemon/lightningd.c

@ -161,6 +161,10 @@ static void config_register_opts(struct lightningd_state *dstate)
opt_register_noarg("--disable-irc", opt_set_invbool,
&dstate->config.use_irc,
"Disable IRC peer discovery for routing");
opt_register_noarg("--ignore-dbversion", opt_set_bool,
&dstate->config.db_version_ignore,
"Continue despite invalid database version (DANGEROUS!)");
}
static void dev_register_opts(struct lightningd_state *dstate)
@ -228,6 +232,9 @@ static const struct config testnet_config = {
/* Discover new peers using IRC */
.use_irc = true,
/* Don't ignore database version */
.db_version_ignore = false,
};
/* aka. "Dude, where's my coins?" */
@ -289,6 +296,9 @@ static const struct config mainnet_config = {
/* Discover new peers using IRC */
.use_irc = true,
/* Don't ignore database version */
.db_version_ignore = false,
};
static void check_config(struct lightningd_state *dstate)

3
daemon/lightningd.h

@ -62,6 +62,9 @@ struct config {
/* Whether to enable IRC peer discovery. */
bool use_irc;
/* Whether to ignore database version. */
bool db_version_ignore;
};
/* Here's where the global variables hide! */

Loading…
Cancel
Save