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

Function test_address

tests/test_misc.py:817–847  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

815
816
817def test_address(node_factory):
818 l1 = node_factory.get_node()
819 addr = l1.rpc.getinfo()['address']
820 assert len(addr) == 0
821
822 bind = l1.rpc.getinfo()['binding']
823 assert len(bind) == 1
824 assert bind[0]['type'] == 'ipv4'
825 assert bind[0]['address'] == '127.0.0.1'
826 assert int(bind[0]['port']) == l1.port
827
828 # Now test UNIX domain binding
829 l1.stop()
830 bind_addr = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, "sock")
831 if len(bind_addr) >= 108 and os.uname()[0] == "Linux":
832 bind_addr = os.path.join('/proc/self/cwd',
833 os.path.relpath(node_factory.directory, os.path.dirname(bind_addr)),
834 os.path.relpath(bind_addr, node_factory.directory))
835 l1.daemon.opts['bind-addr'] = bind_addr
836 l1.start()
837
838 # Test dev-allow-localhost
839 l2 = node_factory.get_node(options={'dev-allow-localhost': None})
840 addr = l2.rpc.getinfo()['address']
841 assert len(addr) == 1
842 assert addr[0]['type'] == 'ipv4'
843 assert addr[0]['address'] == '127.0.0.1'
844 assert int(addr[0]['port']) == l2.port
845
846 ret = l2.rpc.connect(l1.info['id'], l1.daemon.opts['bind-addr'])
847 assert ret['address'] == {'type': 'local socket', 'socket': l1.daemon.opts['bind-addr']}
848
849
850def test_listconfigs(node_factory, bitcoind, chainparams):

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
get_nodeMethod · 0.45
getinfoMethod · 0.45
stopMethod · 0.45
startMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected