mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-20 21:44:29 +01:00
pytest: protect against bad gossip messages from mining confirms too fast.
If we fund a channel between two nodes, then mine all the blocks to announce it, any other nodes may see the announcement before the blocks, causing CI to complain about "bad gossip": ``` lightningd-4: 2022-01-25T22:33:25.468Z DEBUG 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e-gossipd: Ignoring future channel_announcment for 113x1x1 (current block 112) lightningd-4: 2022-01-25T22:33:25.468Z DEBUG 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e-gossipd: Bad gossip order: WIRE_CHANNEL_UPDATE before announcement 113x1x1/0 lightningd-4: 2022-01-25T22:33:25.468Z DEBUG 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e-gossipd: Bad gossip order: WIRE_CHANNEL_UPDATE before announcement 113x1x1/1 lightningd-4: 2022-01-25T22:33:25.468Z DEBUG 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e-gossipd: Bad gossip order: WIRE_NODE_ANNOUNCEMENT before announcement 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e ``` Add a new helper for this case, and use it where there are more than 2 nodes. Cleans up test_routing_gossip and a few other places which did this manually. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -9,7 +9,8 @@ from utils import (
|
||||
DEVELOPER, only_one, sync_blockheight, TIMEOUT, wait_for, TEST_NETWORK,
|
||||
DEPRECATED_APIS, expected_peer_features, expected_node_features,
|
||||
expected_channel_features, account_balance,
|
||||
check_coin_moves, first_channel_id, EXPERIMENTAL_DUAL_FUND
|
||||
check_coin_moves, first_channel_id, EXPERIMENTAL_DUAL_FUND,
|
||||
mine_funding_to_announce
|
||||
)
|
||||
|
||||
import ast
|
||||
@@ -1723,7 +1724,9 @@ def test_hook_crash(node_factory, executor, bitcoind):
|
||||
n.rpc.plugin_start(p)
|
||||
l1.openchannel(n, 10**6, confirm=False, wait_for_announce=False)
|
||||
|
||||
bitcoind.generate_block(6)
|
||||
# Mine final openchannel tx first.
|
||||
sync_blockheight(bitcoind, [l1] + nodes)
|
||||
mine_funding_to_announce(bitcoind, [l1] + nodes, wait_for_mempool=1)
|
||||
|
||||
wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 2 * len(perm))
|
||||
|
||||
@@ -1918,7 +1921,7 @@ def test_coin_movement_notices(node_factory, bitcoind, chainparams):
|
||||
{'may_reconnect': True, 'plugin': coin_plugin},
|
||||
], wait_for_announce=True)
|
||||
|
||||
bitcoind.generate_block(5)
|
||||
mine_funding_to_announce(bitcoind, [l1, l2, l3])
|
||||
wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 4)
|
||||
amount = 10**8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user