-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More flake fixes #7853
Merged
rustyrussell
merged 4 commits into
ElementsProject:master
from
rustyrussell:guilt/fix-flakes9
Nov 22, 2024
Merged
More flake fixes #7853
rustyrussell
merged 4 commits into
ElementsProject:master
from
rustyrussell:guilt/fix-flakes9
Nov 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The test program has a leak, so address sanitizer complains and makes it "fail" the zlib detection test! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Make sure l2 sees CHANNEL_NORMAL too. ``` _____________________________ test_wumbo_channels ______________________________ [gw2] linux -- Python 3.8.18 /home/runner/.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.8/bin/python node_factory = <pyln.testing.utils.NodeFactory object at 0x7fc750f277f0> bitcoind = <pyln.testing.utils.BitcoinD object at 0x7fc750f098b0> @pytest.mark.openchannel('v1') @pytest.mark.openchannel('v2') def test_wumbo_channels(node_factory, bitcoind): # l3 is not wumbo. l1, l2, l3 = node_factory.get_nodes(3, opts=[{}, {}, {'dev-force-features': '-19'}]) conn = l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port) expected_features = expected_peer_features() assert conn['features'] == expected_features assert only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['features'] == expected_features # Now, can we open a giant channel? l1.fundwallet(1 << 26) l1.rpc.fundchannel(l2.info['id'], 1 << 24) # Get that mined, and announced. bitcoind.generate_block(6, wait_for_mempool=1) # Make sure l3 is ready to receive channel announcement! sync_blockheight(bitcoind, [l1, l2, l3]) # Connect l3, get gossip. l3.rpc.connect(l1.info['id'], 'localhost', port=l1.port) # Make sure channel capacity is what we expected (might need to wait for # both channel updates! wait_for(lambda: [c['amount_msat'] for c in l3.rpc.listchannels()['channels']] == [Millisatoshi(str(1 << 24) + "sat")] * 2) # Make sure channel features are right from channel_announcement assert ([c['features'] for c in l3.rpc.listchannels()['channels']] == [expected_channel_features()] * 2) # Make sure we can't open a wumbo channel if we don't agree. with pytest.raises(RpcError, match='Amount exceeded'): l1.rpc.fundchannel(l3.info['id'], 1 << 24) # But we can open and announce a normal one. l1.rpc.fundchannel(l3.info['id'], 'all') bitcoind.generate_block(6, wait_for_mempool=1) wait_for(lambda: l1.channel_state(l3) == 'CHANNELD_NORMAL') # Make sure l2 sees correct size. wait_for(lambda: [c['amount_msat'] for c in l2.rpc.listchannels(l1.get_channel_scid(l3))['channels']] == [Millisatoshi(str((1 << 24) - 1) + "sat")] * 2) # Make sure 'all' works with wumbo peers. l1.rpc.close(l2.info['id']) bitcoind.generate_block(1, wait_for_mempool=1) wait_for(lambda: l1.channel_state(l2) == 'ONCHAIN') l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port) l1.rpc.fundchannel(l2.info['id'], 'all') bitcoind.generate_block(1, wait_for_mempool=1) wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in l1.rpc.listpeerchannels(l2.info['id'])['channels']]) # Exact amount depends on fees, but it will be wumbo! chan = only_one([c for c in l1.rpc.listpeerchannels(l2.info['id'])['channels'] if c['state'] == 'CHANNELD_NORMAL']) amount = chan['funding']['local_funds_msat'] assert amount > Millisatoshi(str((1 << 24) - 1) + "sat") # We should know we can spend that much! spendable = chan['spendable_msat'] assert spendable > Millisatoshi(str((1 << 24) - 1) + "sat") # So should peer. > chan = only_one([c for c in l2.rpc.listpeerchannels(l1.info['id'])['channels'] if c['state'] == 'CHANNELD_NORMAL']) tests/test_connection.py:3552: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ arr = [] def only_one(arr): """Many JSON RPC calls return an array; often we only expect a single entry """ > assert len(arr) == 1 E AssertionError ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We actually mine *300* blocks, not 200, and if timing is right l1 can have mined the txid before mine_txid_or_rbf() checks the mempool: ``` def test_onchaind_replay(node_factory, bitcoind): disconnects = ['+WIRE_REVOKE_AND_ACK', 'permfail'] # Feerates identical so we don't get gratuitous commit to update them l1, l2 = node_factory.line_graph(2, opts=[{'watchtime-blocks': 201, 'cltv-delta': 101, 'disconnect': disconnects, 'feerates': (7500, 7500, 7500, 7500)}, {'watchtime-blocks': 201, 'cltv-delta': 101}], wait_for_announce=True) inv = l2.rpc.invoice(10**8, 'onchaind_replay', 'desc') rhash = inv['payment_hash'] routestep = { 'amount_msat': 10**8 - 1, 'id': l2.info['id'], 'delay': 101, 'channel': first_scid(l1, l2) } l1.rpc.sendpay([routestep], rhash, payment_secret=inv['payment_secret']) l1.daemon.wait_for_log('sendrawtx exit 0') bitcoind.generate_block(1, wait_for_mempool=1) # Wait for nodes to notice the failure, this seach needle is after the # DB commit so we're sure the tx entries in onchaindtxs have been added l1.daemon.wait_for_log("Deleting channel .* due to the funding outpoint being spent") l2.daemon.wait_for_log("Deleting channel .* due to the funding outpoint being spent") # We should at least have the init tx now assert len(l1.db_query("SELECT * FROM channeltxs;")) > 0 assert len(l2.db_query("SELECT * FROM channeltxs;")) > 0 # Generate some blocks so we restart the onchaind from DB (we rescan # last_height - 100) bitcoind.generate_block(100) sync_blockheight(bitcoind, [l1, l2]) # l1 should still have a running onchaind assert len(l1.db_query("SELECT * FROM channeltxs;")) > 0 l2.rpc.stop() l1.restart() # Can't wait for it, it's after the "Server started" wait in restart() assert l1.daemon.is_in_log(r'Restarting onchaind \(ONCHAIN\): closed in block 109') # l1 should still notice that the funding was spent and that we should react to it _, txid, blocks = l1.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET', 'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US') assert blocks == 200 bitcoind.generate_block(200) # Could be RBF! > l1.mine_txid_or_rbf(txid) tests/test_closing.py:1864: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ contrib/pyln-testing/pyln/testing/utils.py:1375: in mine_txid_or_rbf wait_for(lambda: rbf_or_txid_broadcast(txids)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ success = <function LightningNode.mine_txid_or_rbf.<locals>.<lambda> at 0x7f9b129c4550> timeout = 180 def wait_for(success, timeout=TIMEOUT): start_time = time.time() interval = 0.25 while not success(): time_left = start_time + timeout - time.time() if time_left <= 0: > raise ValueError("Timeout while waiting for {}".format(success)) E ValueError: Timeout while waiting for <function LightningNode.mine_txid_or_rbf.<locals>.<lambda> at 0x7f9b129c4550> ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We can get more gossip_filter messages now. And we can also go over max-messages, so increase that too. ``` del tally['query_short_channel_ids'] del tally['query_channel_range'] del tally['ping'] > assert tally == {'channel_announce': 1, 'channel_update': 3, 'node_announce': 1, 'gossip_filter': 1} E AssertionError: assert {'channel_ann..._announce': 1} == {'channel_ann..._announce': 1} E Omitting 2 identical items, use -vv to show E Differing items: E {'gossip_filter': 2} != {'gossip_filter': 1} E {'channel_update': 2} != {'channel_update': 3} E Full diff: E { E 'channel_announce': 1,... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_gossip.py:2326: AssertionError ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell
force-pushed
the
guilt/fix-flakes9
branch
from
November 22, 2024 02:20
809219f
to
621c51d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog-None