MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_gossipwith

Function test_gossipwith

tests/test_gossip.py:1395–1421  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

1393
1394
1395def test_gossipwith(node_factory):
1396 l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
1397
1398 out = subprocess.run(['devtools/gossipwith',
1399 '--all-gossip',
1400 '--network={}'.format(TEST_NETWORK),
1401 '--timeout-after={}'.format(int(math.sqrt(TIMEOUT) + 1)),
1402 '{}@localhost:{}'.format(l1.info['id'], l1.port)],
1403 check=True,
1404 timeout=TIMEOUT, stdout=subprocess.PIPE).stdout
1405
1406 msgs = set()
1407 while len(out):
1408 l, t = struct.unpack('>HH', out[0:4])
1409 msg = out[2:2 + l]
1410 out = out[2 + l:]
1411
1412 # Ignore pings, gossip_timestamp_filter, query_channel_range
1413 if t in (18, 263, 265):
1414 continue
1415 # channel_announcement node_announcement or channel_update
1416 assert t == 256 or t == 257 or t == 258
1417 msgs.add(msg)
1418
1419 # one channel announcement, two channel_updates, two node announcements.
1420 # due to initial blast, we can have duplicates!
1421 assert len(msgs) == 5
1422
1423
1424def test_gossip_notices_close(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 3

line_graphMethod · 0.80
runMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected