Skip to content

Commit 0c5c4fd

Browse files
committed
pytest: fix race in test_reconnect_remote_sends_no_sigs
We can be a bit early in our assertion: ``` @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "sqlite3-specific DB manip") def test_reconnect_remote_sends_no_sigs(node_factory): """We re-announce, even when remote node doesn't send its announcement_signatures on reconnect. """ l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts={'may_reconnect': True, 'dev-no-reconnect': None}) # Wipe l2's gossip_store l2.stop() gs_path = os.path.join(l2.daemon.lightning_dir, TEST_NETWORK, 'gossip_store') os.unlink(gs_path) l2.start() # l2 will now uses (REMOTE's) announcement_signatures it has stored wait_for(lambda: l2.rpc.listchannels()['channels'] != []) # Remove remote signatures from l1 so it asks for them (and delete gossip store) l1.db_manip("UPDATE channels SET remote_ann_node_sig=NULL, remote_ann_bitcoin_sig=NULL") gs_path = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'gossip_store') os.unlink(gs_path) l1.restart() l1.connect(l2) l1needle = l1.daemon.logsearch_start l2needle = l2.daemon.logsearch_start # l1 asks once, l2 replies once. # Make sure we get all the msgs! time.sleep(5) l1.daemon.wait_for_log('peer_out WIRE_ANNOUNCEMENT_SIGNATURES') l2.daemon.wait_for_log('peer_out WIRE_ANNOUNCEMENT_SIGNATURES') l1msgs = [l.split()[4] for l in l1.daemon.logs[l1needle:] if 'WIRE_ANNOUNCEMENT_SIGNATURES' in l] > assert l1msgs == ['peer_out', 'peer_in'] E AssertionError: assert ['peer_out'] == ['peer_out', 'peer_in'] E Right contains one more item: 'peer_in' E Full diff: E - ['peer_out', 'peer_in'] E + ['peer_out'] ``` ``` lightningd-2 2025-01-24T05:53:22.862Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_out WIRE_ANNOUNCEMENT_SIGNATURES lightningd-1 2025-01-24T05:53:22.864Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#1: peer_in WIRE_ANNOUNCEMENT_SIGNATURES lightningd-1 2025-01-24T05:53:22.885Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: channel_gossip: received announcement sigs for 103x1x0 (we have 103x1x0) {'github_repository': 'ElementsProject/lightning', 'github_sha': 'e9d36f2b8ecd45882753cbe062c355e40bc7109c', 'github_ref': 'refs/pull/8027/merge', 'github_ref_name': 'HEAD', 'github_run_id': 12943530601, 'github_head_ref': ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent e85a276 commit 0c5c4fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,8 @@ def test_reconnect_remote_sends_no_sigs(node_factory):
990990
# Make sure we get all the msgs!
991991
time.sleep(5)
992992

993-
l1.daemon.wait_for_log('peer_out WIRE_ANNOUNCEMENT_SIGNATURES')
993+
l1.daemon.wait_for_logs(['peer_out WIRE_ANNOUNCEMENT_SIGNATURES',
994+
'peer_in WIRE_ANNOUNCEMENT_SIGNATURES'])
994995
l2.daemon.wait_for_log('peer_out WIRE_ANNOUNCEMENT_SIGNATURES')
995996

996997
l1msgs = [l.split()[4] for l in l1.daemon.logs[l1needle:] if 'WIRE_ANNOUNCEMENT_SIGNATURES' in l]

0 commit comments

Comments
 (0)