diff --git a/wallet/db.c b/wallet/db.c index 0270ba129..9d09dd8e5 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -196,6 +196,8 @@ char *dbmigrations[] = { "DELETE FROM channels WHERE state=1", /* Keep track of db ugprades, for debugging */ "CREATE TABLE db_upgrades (upgrade_from INTEGER, lightning_version TEXT);", + /* We used not to clean up peers when their channels were gone. */ + "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);", NULL, };