diff --git a/wallet/db.c b/wallet/db.c index 40d2f139b..633983ce7 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -18,7 +18,7 @@ struct migration { void (*func)(struct lightningd *ld, struct db *db); }; -void migrate_pr2342_feerate_per_channel(struct lightningd *ld, struct db *db); +static void migrate_pr2342_feerate_per_channel(struct lightningd *ld, struct db *db); /* Do not reorder or remove elements from this array, it is used to * migrate existing databases from a previous state, based on the @@ -451,6 +451,12 @@ static struct migration dbmigrations[] = { * in the list view anyway, e.g., show all close and htlc transactions * as a single bundle. */ {SQL("ALTER TABLE transactions ADD channel_id INTEGER;"), NULL}, + /* Convert pre-Adelaide short_channel_ids */ + {SQL("UPDATE channels" + " SET short_channel_id = REPLACE(short_channel_id, ':', 'x')" + " WHERE short_channel_id IS NOT NULL;"), NULL }, + {SQL("UPDATE payments SET failchannel = REPLACE(failchannel, ':', 'x')" + " WHERE failchannel IS NOT NULL;"), NULL }, }; /* Leak tracking. */ @@ -825,7 +831,7 @@ void db_set_intvar(struct db *db, char *varname, s64 val) } /* Will apply the current config fee settings to all channels */ -void migrate_pr2342_feerate_per_channel(struct lightningd *ld, struct db *db) +static void migrate_pr2342_feerate_per_channel(struct lightningd *ld, struct db *db) { struct db_stmt *stmt = db_prepare_v2( db, SQL("UPDATE channels SET feerate_base = ?, feerate_ppm = ?;")); diff --git a/wallet/test/run-db.c b/wallet/test/run-db.c index bd8642250..1e444eff8 100644 --- a/wallet/test/run-db.c +++ b/wallet/test/run-db.c @@ -133,6 +133,7 @@ static bool test_vars(struct lightningd *ld) int main(void) { setup_locale(); + setup_tmpctx(); bool ok = true; /* Dummy for migration hooks */ @@ -144,5 +145,6 @@ int main(void) ok &= test_primitives(); tal_free(ld); + tal_free(tmpctx); return !ok; }