Browse Source

db: fix dangling peers on db upgrade.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
confirmed-only
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
6ed54dd34e
  1. 3
      tests/test_db.py
  2. 2
      wallet/db.c

3
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')

2
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,
};

Loading…
Cancel
Save