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

Function test_tor_port_onions

tests/test_gossip.py:1915–1939  ·  view source on GitHub ↗

First basic tests for torport ;-) 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

1913
1914
1915def test_tor_port_onions(node_factory):
1916 """First basic tests for torport ;-)
1917
1918 Assume that tor is configured and just test
1919 if we see the right onion address for our blob
1920 """
1921 # please define your values
1922 torip = '127.0.0.1'
1923 torips = '127.0.0.1:9051'
1924 torport = 9050
1925 torserviceport = 9051
1926
1927 if not check_socket(torip, torserviceport):
1928 return
1929
1930 if not check_socket(torip, torport):
1931 return
1932
1933 portA = node_factory.get_unused_port()
1934 l1 = node_factory.get_node(may_fail=True, options={'bind-addr': '127.0.0.1:{}'.format(portA), 'addr': ['statictor:{}/torport=45321'.format(torips)]})
1935 portB = node_factory.get_unused_port()
1936 l2 = node_factory.get_node(may_fail=True, options={'bind-addr': '127.0.0.1:{}'.format(portB), 'addr': ['statictor:{}/torport=45321/torblob=11234567890123456789012345678901'.format(torips)]})
1937
1938 assert l1.daemon.is_in_log('45321,127.0.0.1:{}'.format(l1.port))
1939 assert l2.daemon.is_in_log('x2y4zvh4fn5q3eouuh7nxnc7zeawrqoutljrup2xjtiyxgx3emgkemad.onion:45321,127.0.0.1:{}'.format(l2.port))
1940
1941
1942def test_routetool(node_factory):

Callers

nothing calls this directly

Calls 4

check_socketFunction · 0.85
get_unused_portMethod · 0.80
is_in_logMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected