From 8f484069855a8975613e59730d49d84654d4a35e Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Sat, 15 Oct 2022 11:23:57 -0500 Subject: [PATCH] pytest: test for gossip store corruption by private channel updates Adds a simple test covering the gossip_store corruption issue #5656 stemming from failure to delete prior private channel updates in all cases. --- tests/test_gossip.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index f2e0a34ca..0e07183b6 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -2165,3 +2165,33 @@ def test_close_12_block_delay(node_factory, bitcoind): # One more block, it's forgotten too. bitcoind.generate_block(1) wait_for(lambda: l4.rpc.listchannels(source=l2.info['id'])['channels'] == []) + + +@pytest.mark.developer("needs --dev-fast-gossip") +def test_gossip_private_updates(node_factory, bitcoind): + """Check that private channel updates are properly added and deleted from + the gossip store. + + """ + l1, l2 = node_factory.get_nodes(2) + + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + scid, _ = l1.fundchannel(l2, 10**6, None, False) + bitcoind.generate_block(5) + + l1.wait_channel_active(scid) + l2.wait_channel_active(scid) + + l2.rpc.setchannel(l1.info['id'], feebase=11) + wait_for(lambda: sum([c['base_fee_millisatoshi'] for c in l1.rpc.listchannels()['channels']]) == 12) + l2.rpc.setchannel(l1.info['id'], feebase=12) + wait_for(lambda: sum([c['base_fee_millisatoshi'] for c in l1.rpc.listchannels()['channels']]) == 13) + l2.rpc.setchannel(l1.info['id'], feebase=13) + wait_for(lambda: sum([c['base_fee_millisatoshi'] for c in l1.rpc.listchannels()['channels']]) == 14) + l2.rpc.setchannel(l1.info['id'], feebase=14) + wait_for(lambda: sum([c['base_fee_millisatoshi'] for c in l1.rpc.listchannels()['channels']]) == 15) + l2.rpc.setchannel(l1.info['id'], feebase=15) + wait_for(lambda: sum([c['base_fee_millisatoshi'] for c in l1.rpc.listchannels()['channels']]) == 16) + l1.restart() + + wait_for(lambda: l1.daemon.is_in_log(r'gossip_store_compact_offline: 5 deleted, 3 copied'))