diff --git a/tests/test_db.py b/tests/test_db.py index 315fdd7ce..692581a73 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -1,9 +1,6 @@ from fixtures import * # noqa: F401,F403 -import pytest - -@pytest.mark.xfail(strict=True) def test_db_dangling_peer_fix(node_factory): # This was taken from test_fail_unconfirmed() node. l1 = node_factory.get_node(dbfile='dangling-peer.sqlite3.xz') diff --git a/wallet/db.c b/wallet/db.c index 2b48a4afa..25d1756d0 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -356,6 +356,8 @@ char *dbmigrations[] = { ");", /* Add a direction for failed payments. */ "ALTER TABLE payments ADD faildirection INTEGER;", /* erring_direction */ + /* Fix dangling peers with no channels. */ + "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);", NULL, };