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

Function test_real_data

tests/test_askrene.py:1575–1683  ·  view source on GitHub ↗
(node_factory, bitcoind, executor)

Source from the content-addressed store, hash-verified

1573
1574@pytest.mark.slow_test
1575def test_real_data(node_factory, bitcoind, executor):
1576 # Route from Rusty's node to the top nodes
1577 # From tests/data/gossip-store-2026-02-03-node-map.xz:
1578 # Me: 2134:024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605:BLUEIRON
1579 # So we make l2 node 2134.
1580 outfile = tempfile.NamedTemporaryFile(prefix='gossip-store-')
1581 nodeids = subprocess.check_output(['devtools/gossmap-compress',
1582 'decompress',
1583 '--node-map=2134=033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a',
1584 'tests/data/gossip-store-2026-02-03.compressed',
1585 outfile.name]).decode('utf-8').splitlines()
1586
1587 # This is in msat, but is also the size of channel we create.
1588 AMOUNT = 100000000
1589
1590 # l2 complains being given bad gossip from l1, throttle to reduce
1591 # the sheer amount of log noise.
1592 l1, l2 = node_factory.line_graph(2, fundamount=AMOUNT,
1593 opts=[{'gossip_store_file': outfile.name,
1594 'allow_warning': True,
1595 'dev-throttle-gossip': None,
1596 'broken_log': 'Throttling (incoming|outgoing) peer',
1597 # This can be slow!
1598 'askrene-timeout': TIMEOUT},
1599 {'allow_warning': True}])
1600
1601 # CI, it's slow.
1602 if SLOW_MACHINE:
1603 limit = 25
1604 expected = (14, 24, 4663500, 209635, 96)
1605 else:
1606 limit = 100
1607 expected = (17, 95, 16558980, 911656, 95)
1608
1609 # 0.5% is the norm
1610 MAX_FEE = AMOUNT // 200
1611
1612 # Do these in parallel.
1613 futs = {}
1614 for n in range(0, limit):
1615 futs[n] = executor.submit(l1.rpc.getroutes,
1616 source=l1.info['id'],
1617 destination=nodeids[n],
1618 amount_msat=AMOUNT,
1619 layers=['auto.sourcefree', 'auto.localchans'],
1620 maxfee_msat=MAX_FEE,
1621 final_cltv=18)
1622
1623 fees = {}
1624 prevs = {}
1625 for n in range(0, limit):
1626 fees[n] = []
1627 if n in canned_gossmap_badnodes:
1628 with pytest.raises(RpcError, match=canned_gossmap_badnodes[n]):
1629 futs[n].result(TIMEOUT)
1630 continue
1631
1632 prevs[n] = futs[n].result(TIMEOUT)

Callers

nothing calls this directly

Calls 3

line_graphMethod · 0.80
is_in_logMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected