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

Function test_statictor_onions

tests/test_gossip.py:1971–2002  ·  view source on GitHub ↗

First basic tests ;-) Assume that tor is configured and just test if we see the right onion address for our blob

(node_factory)

Source from the content-addressed store, hash-verified

1969
1970@pytest.mark.developer("needs a running Tor service instance at port 9151 or 9051")
1971def test_statictor_onions(node_factory):
1972 """First basic tests ;-)
1973
1974 Assume that tor is configured and just test
1975 if we see the right onion address for our blob
1976 """
1977 # please define your values
1978 torip = '127.0.0.1'
1979 torips = '127.0.0.1:9051'
1980 torport = 9050
1981 torserviceport = 9051
1982 portA, portB = reserve(), reserve()
1983
1984 if not check_socket(format(torip), torserviceport):
1985 return
1986
1987 if not check_socket(format(torip), torport):
1988 return
1989
1990 l1 = node_factory.get_node(may_fail=True, options={
1991 'bind-addr': '127.0.0.1:{}'.format(portA),
1992 'addr': ['statictor:{}'.format(torips)]
1993 })
1994 l2 = node_factory.get_node(may_fail=True, options={
1995 'bind-addr': '127.0.0.1:{}'.format(portB),
1996 'addr': ['statictor:{}/torblob=11234567890123456789012345678901/torport={}'.format(torips, 9736)]
1997 })
1998
1999 assert l1.daemon.is_in_log('127.0.0.1:{}'.format(l1.port))
2000 # Did not specify torport, so it's the default.
2001 assert l1.daemon.is_in_log('.onion:{}'.format(default_ln_port(l1.info["network"])))
2002 assert l2.daemon.is_in_log('x2y4zvh4fn5q3eouuh7nxnc7zeawrqoutljrup2xjtiyxgx3emgkemad.onion:{},127.0.0.1:{}'.format(9736, l2.port))
2003
2004
2005@pytest.mark.developer("needs a running Tor service instance at port 9151 or 9051")

Callers

nothing calls this directly

Calls 5

default_ln_portFunction · 0.90
check_socketFunction · 0.85
formatEnum · 0.85
is_in_logMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected