Skip to content

CI Flake test_gossip_force_broadcast_channel_msgs #9270

Description

@ddustin

It appears sometimes two channels are announced instead of the expected 1. Either two channel announcements is fine or the duplicate announcement is a sign of some underlying bug.

(CI Log)

    def test_gossip_force_broadcast_channel_msgs(node_factory, bitcoind):
        """ Send our own channel_update, node_announcement or channel_announcement to existing peers, even if they say they're not interested.
        """
        l1, l2 = node_factory.get_nodes(2)
    
        # One block away from being announced.
        node_factory.join_nodes([l1, l2], wait_for_announce=False)
        bitcoind.generate_block(4)
    
        # It will send timestamp_filter. It should also send a channel_announcement, a
        # channel_update, and a node_announcement, even though we said no gossip.
        # It may or may not send:
        #  query_short_channel_ids, query_channel_range, a ping (which we gossipwith replies to)
        process = subprocess.Popen(['devtools/gossipwith',
                                    '--no-gossip',
                                    '--hex',
                                    '--network={}'.format(TEST_NETWORK),
                                    '--max-messages={}'.format(7),
                                    '--handle-pings',
                                    '--timeout-after=30',
                                    '{}@localhost:{}'.format(l1.info['id'], l1.port)],
                                   stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        # Now do the final announcement
        bitcoind.generate_block(1)
    
        stdout, stderr = process.communicate(timeout=30 + TIMEOUT)
        assert process.returncode == 0, f"Exit failed: output = {stderr}"
    
        lines = stdout.decode('utf-8').splitlines()
        types = {'0100': 'channel_announce',
                 '0102': 'channel_update',
                 '0101': 'node_announce',
                 '0105': 'query_short_channel_ids',
                 '0107': 'query_channel_range',
                 '0109': 'gossip_filter',
                 '0012': 'ping'}
        tally = {key: 0 for key in types.values()}
        for l in lines:
            tally[types[l[0:4]]] += 1
    
        # Make sure the noise is within reasonable bounds
        assert tally['query_short_channel_ids'] <= 1
        assert tally['query_channel_range'] <= 1
        assert tally['ping'] <= 5
        assert tally['gossip_filter'] >= 1
        del tally['query_short_channel_ids']
        del tally['query_channel_range']
        del tally['ping']
        del tally['gossip_filter']
>       assert tally == {'channel_announce': 1,
                         'channel_update': 1,
                         'node_announce': 1}
E       AssertionError: assert {'channel_announce': 2, 'channel_update': 1, 'node_announce': 1} == {'channel_announce': 1, 'channel_update': 1, 'node_announce': 1}
E         
E         Common items:
E         {'channel_update': 1, 'node_announce': 1}
E         Differing items:
E         {'channel_announce': 2} != {'channel_announce': 1}
E         
E         Full diff:
E           {
E         -     'channel_announce': 1,
E         ?                         ^
E         +     'channel_announce': 2,
E         ?                         ^
E               'channel_update': 1,
E               'node_announce': 1,
E           }

tests/test_gossip.py:2408: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions