From 0ff1c7ab0cc693f736dbe0d2537aeb4a3a092c6a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 19 Aug 2025 10:30:46 +0930 Subject: [PATCH] pytest: test for parallel refresh. If we do this, we get a database error (now we try to refresh intelligently, is this is currently only chainmoves / channelmoves). Signed-off-by: Rusty Russell --- tests/test_plugin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 72768199cc..d84c645c0c 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -4258,6 +4258,20 @@ def test_sql_crash(node_factory, bitcoind): l1.rpc.sql(f"SELECT * FROM peerchannels;") +@pytest.mark.xfail(strict=True) +def test_sql_parallel(node_factory, executor): + """Parallel refreshes of tables causes SQL errors: + Error executing INSERT INTO chainmoves VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?); on row 0: UNIQUE constraint failed: chainmoves.created_index + """ + l1, l2 = node_factory.line_graph(2) + + futs = [] + for _ in range(5): + futs.append(executor.submit(l1.rpc.sql, "SELECT * FROM chainmoves")) + for f in futs: + f.result(TIMEOUT) + + def test_listchannels_broken_message(node_factory): """This gave a bogus BROKEN message with deprecated-apis enabled""" l1 = node_factory.get_node(options={'allow-deprecated-apis': True})