From df4f627a069a003ca288871f586f4a7289135427 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 24 Apr 2024 13:05:40 +0930 Subject: [PATCH] pytest: clean up tests/test_db.py::test_last_tx_psbt_upgrade Ignore bad gossip, and use the broken_log option rather than manually filtering logs. Signed-off-by: Rusty Russell --- tests/test_db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_db.py b/tests/test_db.py index 4f8f30394b06..544ccc41e385 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -193,6 +193,10 @@ def test_last_tx_psbt_upgrade(node_factory, bitcoind): upgraded_psbts = ['cHNidP8BAgQCAAAAAQME74HcIAEEAQEBBQEDAQYBAwH7BAIAAAAAAQErQEIPAAAAAAAiACCiWhNhgwfpKsHIgLqGzpSdj8cCpITLFVpVRddsOobajiICAjJCZt6EA7OrFXoJ8feE1YevYYMcmYwVG8whu3TCsjFLRzBEAiBhqTjjdJx2TqTNUwYJgmjhH6p8FJnbnj/N/Jv0dEiQmwIgXG/ki8U0iN0YPbrhpl7goGhXUj/8+JRg0uKLJrkHLrsBAQMEAQAAAAEFR1IhAgZUBJOphZmWemHEUXLfSWgeOYpssIkKUG5092wtK+JCIQIyQmbehAOzqxV6CfH3hNWHr2GDHJmMFRvMIbt0wrIxS1KuIgYCBlQEk6mFmZZ6YcRRct9JaB45imywiQpQbnT3bC0r4kIIWA8TsgAAAAAiBgIyQmbehAOzqxV6CfH3hNWHr2GDHJmMFRvMIbt0wrIxSwhK0xNpAAAAAAEOII3WmYYbAAYeUJN6Iz21hL+O1MC/ULRMBBH3GwMaBkVQAQ8EAAAAAAEQBA73qYAAAQMIUMMAAAAAAAABBCIAIHM1bP9+FYjxSTXvE44UKr77X349Ud6UJ1jc1aF5RJtiAAEDCFCpBgAAAAAAAQQiACAt9UXqiCiJhGxS/F4RGsB84H4MCUGKwVdDpvYoTCpPpwABAwggoQcAAAAAAAEEFgAU6JlU+sj3otzlHglde+tSccP32l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/10wg1K0YezmnzwoTywkEgj9r2whAAAAAAEOIDXaspluV3YuPsFYwNV9OfQ8plfogtk/wk9f66qPNu2aAQ8EAQAAAAEQBFZtHYAAAQMIUMMAAAAAAAABBCIAIFZ5p9BuG9J2qiX1bp5N9+B9mDfvsMX2NgTxDNn3ZqA+AAEDCNTdBgAAAAAAAQQWABR+W1yPT8GpSE4ln5LKTLt/ooFOpAABAwiabAcAAAAAAAEEIgAgq2Im3r/+/0p0HAE2f6PIdRckg8+z4yfQ+MeqTFHt7KoA'] l1 = node_factory.get_node(dbfile='last_tx_upgrade.sqlite3.xz', + # FIXME: gossipd gets upset, since it seems like the db with remote announcement_sigs was + # actually from l2, not l1. But if we make this l1, then last_tx changes + broken_log='gossipd rejected our channel announcement', + allow_bad_gossip=True, options={'database-upgrade': True}) b64_last_txs = [base64.b64encode(x['last_tx']).decode('utf-8') for x in l1.db_query('SELECT last_tx FROM channels ORDER BY id;')] @@ -207,6 +211,8 @@ def test_last_tx_psbt_upgrade(node_factory, bitcoind): time.sleep(2) l2 = node_factory.get_node(dbfile='last_tx_closed.sqlite3.xz', + broken_log='gossipd rejected our channel announcement', + allow_bad_gossip=True, options={'database-upgrade': True}) last_txs = [x['last_tx'] for x in l2.db_query('SELECT last_tx FROM channels ORDER BY id;')] @@ -215,12 +221,6 @@ def test_last_tx_psbt_upgrade(node_factory, bitcoind): bitcoind.rpc.decoderawtransaction(last_txs[1].hex()) - # FIXME: gossipd gets upset, since it seems like the db with remote announcement_sigs was - # actually from l2, not l1. But if we make this l1, then last_tx changes, so we just - # filter out gossipd messages here (we will still detect other broken msgs!) - l1.daemon.logs = [l for l in l1.daemon.logs if 'gossipd' not in l] - l2.daemon.logs = [l for l in l2.daemon.logs if 'gossipd' not in l] - @pytest.mark.slow_test @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This test is based on a sqlite3 snapshot")