We *should* send all self-related gossip unsolicited, if we have any
(node_factory)
| 2125 | |
| 2126 | |
| 2127 | def test_dump_own_gossip(node_factory): |
| 2128 | """We *should* send all self-related gossip unsolicited, if we have any""" |
| 2129 | l1, l2 = node_factory.line_graph(2, wait_for_announce=True) |
| 2130 | |
| 2131 | # Make sure l1 has updates in both directions, and node_announcements |
| 2132 | wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 2) |
| 2133 | wait_for(lambda: len(l1.rpc.listnodes()['nodes']) == 2) |
| 2134 | |
| 2135 | # We should get channel_announcement, channel_update, node_announcement. |
| 2136 | # (Plus random pings, timestamp_filter) |
| 2137 | out = subprocess.run(['devtools/gossipwith', |
| 2138 | '--no-gossip', |
| 2139 | '--timeout-after={}'.format(int(math.sqrt(TIMEOUT) + 1)), |
| 2140 | '--network={}'.format(TEST_NETWORK), |
| 2141 | '{}@localhost:{}'.format(l1.info['id'], l1.port)], |
| 2142 | check=True, |
| 2143 | timeout=TIMEOUT, stdout=subprocess.PIPE).stdout |
| 2144 | |
| 2145 | # In theory, we could do the node_announcement any time after channel_announcement, but we don't. |
| 2146 | expect = [256, # channel_announcement |
| 2147 | 258, # channel_update |
| 2148 | 258, # channel_update |
| 2149 | 257] # node_announcement |
| 2150 | |
| 2151 | while len(out): |
| 2152 | l, t = struct.unpack('>HH', out[0:4]) |
| 2153 | out = out[2 + l:] |
| 2154 | |
| 2155 | # Ignore pings, timestamp_filter, query_channel_range |
| 2156 | if t in (18, 263, 265): |
| 2157 | continue |
| 2158 | |
| 2159 | assert t == expect[0] |
| 2160 | expect = expect[1:] |
| 2161 | |
| 2162 | # We should get exactly what we expected. |
| 2163 | assert expect == [] |
| 2164 | |
| 2165 | |
| 2166 | def test_gossip_throttle(node_factory, bitcoind, chainparams): |
nothing calls this directly
no test coverage detected