| 815 | |
| 816 | |
| 817 | def 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 | |
| 850 | def test_listconfigs(node_factory, bitcoind, chainparams): |