(node_factory, bitcoind)
| 3811 | |
| 3812 | @pytest.mark.openchannel('v1') |
| 3813 | def test_version_reexec(node_factory, bitcoind): |
| 3814 | badopeningd = os.path.join(os.path.dirname(__file__), "plugins", "badopeningd.sh") |
| 3815 | version = subprocess.check_output(['lightningd/lightningd', |
| 3816 | '--version']).decode('utf-8').splitlines()[0] |
| 3817 | |
| 3818 | l1, l2 = node_factory.get_nodes(2, opts=[{'subdaemon': 'openingd:' + badopeningd, |
| 3819 | 'start': False, |
| 3820 | 'broken_log': "openingd.*version 'badversion' not '.*': restarting"}, |
| 3821 | {}]) |
| 3822 | # We use a file to tell our openingd wrapper where the real one is |
| 3823 | with open(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, "openingd-real"), 'w') as f: |
| 3824 | f.write(os.path.abspath('lightningd/lightning_openingd')) |
| 3825 | l1.start() |
| 3826 | # This is a "version" message |
| 3827 | verfile = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, "openingd-version") |
| 3828 | with open(verfile, 'wb') as f: |
| 3829 | f.write(bytes.fromhex('0000000d' # len |
| 3830 | 'fff6')) # type |
| 3831 | f.write(bytes('badversion\0', encoding='utf8')) |
| 3832 | |
| 3833 | # Opening a channel will fire subd. |
| 3834 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 3835 | try: |
| 3836 | l1.fundchannel(l2) |
| 3837 | except RpcError: |
| 3838 | pass |
| 3839 | |
| 3840 | l1.daemon.wait_for_log("openingd.*version 'badversion' not '{}': restarting".format(version)) |
| 3841 | |
| 3842 | # Now "fix" it, it should restart. |
| 3843 | os.unlink(verfile) |
| 3844 | l1.daemon.wait_for_log("Server started with public key") |
| 3845 | |
| 3846 | |
| 3847 | def test_notimestamp_logging(node_factory): |
nothing calls this directly
no test coverage detected