MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_strict_mode_with_old_database

Function test_strict_mode_with_old_database

tests/test_db.py:683–704  ·  view source on GitHub ↗

Test old database upgrades work (STRICT not applied during migrations).

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

681@unittest.skipIf(not COMPAT, "needs COMPAT to test old database upgrade")
682@unittest.skipIf(TEST_NETWORK != 'regtest', "The network must match the DB snapshot")
683def test_strict_mode_with_old_database(node_factory, bitcoind):
684 """Test old database upgrades work (STRICT not applied during migrations)."""
685 bitcoind.generate_block(1)
686
687 l1 = node_factory.get_node(dbfile='oldstyle-scids.sqlite3.xz',
688 options={'database-upgrade': True,
689 'developer': None})
690
691 assert l1.rpc.getinfo()['id'] is not None
692
693 strict_tables = l1.db_query(
694 "SELECT name FROM sqlite_master "
695 "WHERE type='table' AND sql LIKE '%STRICT%'"
696 )
697 assert len(strict_tables) == 0, "Upgraded database should not have STRICT tables"
698
699 # Verify BLOB->TEXT migration ran for faildetail cleanup.
700 result = l1.db_query(
701 "SELECT COUNT(*) as count FROM payments "
702 "WHERE typeof(faildetail) = 'blob'"
703 )
704 assert result[0]['count'] == 0, "Found BLOB-typed faildetail after migration"

Callers

nothing calls this directly

Calls 4

generate_blockMethod · 0.80
db_queryMethod · 0.80
get_nodeMethod · 0.45
getinfoMethod · 0.45

Tested by

no test coverage detected