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

Function test_new_node_is_mainnet

tests/test_misc.py:2811–2837  ·  view source on GitHub ↗

Test that an empty directory causes us to be on mainnet

(node_factory)

Source from the content-addressed store, hash-verified

2809@unittest.skipIf(VALGRIND, "valgrind files can't be written since we rmdir")
2810@unittest.skipIf(TEST_NETWORK != "regtest", "needs bitcoin mainnet")
2811def test_new_node_is_mainnet(node_factory):
2812 """Test that an empty directory causes us to be on mainnet"""
2813 l1 = node_factory.get_node(start=False, may_fail=True)
2814
2815 basedir = l1.daemon.opts.get("lightning-dir")
2816 netdir = os.path.join(basedir, "bitcoin")
2817
2818 shutil.rmtree(basedir)
2819
2820 # Don't suppress upgrade (though it shouldn't happen!)
2821 del l1.daemon.opts['allow-deprecated-apis']
2822 # We want to test default network
2823 del l1.daemon.opts['network']
2824
2825 # Wrong chain, will fail to start, but that's OK.
2826 l1.daemon.start(wait_for_initialized=False)
2827 # Will exit with failure code.
2828 assert l1.daemon.wait() == 1
2829
2830 # Should create these
2831 assert os.path.isfile(os.path.join(netdir, "hsm_secret"))
2832 assert not os.path.isfile(os.path.join(basedir, "hsm_secret"))
2833 assert not os.path.isfile(os.path.join(netdir, "lightningd-bitcoin.pid"))
2834 assert os.path.isfile(os.path.join(basedir, "lightningd-bitcoin.pid"))
2835
2836 # Teardown expects this to exist...
2837 os.mkdir(basedir + "/plugin-io")
2838
2839
2840def test_unicode_rpc(node_factory, executor, bitcoind):

Callers

nothing calls this directly

Calls 5

joinMethod · 0.80
get_nodeMethod · 0.45
getMethod · 0.45
startMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected