(node_factory, bitcoind)
| 2929 | @pytest.mark.openchannel('v1') |
| 2930 | @pytest.mark.openchannel('v2') |
| 2931 | def test_dataloss_protection(node_factory, bitcoind): |
| 2932 | l1 = node_factory.get_node(may_reconnect=True, options={'log-level': 'io'}, |
| 2933 | allow_warning=True, |
| 2934 | feerates=(7500, 7500, 7500, 7500)) |
| 2935 | l2 = node_factory.get_node(may_reconnect=True, options={'log-level': 'io'}, |
| 2936 | feerates=(7500, 7500, 7500, 7500), allow_broken_log=True) |
| 2937 | |
| 2938 | lf = expected_peer_features() |
| 2939 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 2940 | # l1 should send out WIRE_INIT (0010) |
| 2941 | l1.daemon.wait_for_log(r"\[OUT\] 0010.*" |
| 2942 | # lflen |
| 2943 | + format(len(lf) // 2, '04x') |
| 2944 | + lf) |
| 2945 | |
| 2946 | l1.fundchannel(l2, 10**6) |
| 2947 | l2.stop() |
| 2948 | |
| 2949 | # Save copy of the db. |
| 2950 | dbpath = os.path.join(l2.daemon.lightning_dir, TEST_NETWORK, "lightningd.sqlite3") |
| 2951 | orig_db = open(dbpath, "rb").read() |
| 2952 | l2.start() |
| 2953 | |
| 2954 | # l1 should have sent WIRE_CHANNEL_REESTABLISH with extra fields. |
| 2955 | l1.daemon.wait_for_log(r"\[OUT\] 0088" |
| 2956 | # channel_id |
| 2957 | "[0-9a-f]{64}" |
| 2958 | # next_local_commitment_number |
| 2959 | "0000000000000001" |
| 2960 | # next_remote_revocation_number |
| 2961 | "0000000000000000" |
| 2962 | # your_last_per_commitment_secret (funding_depth may |
| 2963 | # trigger a fee-update and commit, hence this may not |
| 2964 | # be zero) |
| 2965 | "[0-9a-f]{64}" |
| 2966 | # my_current_per_commitment_point |
| 2967 | "0[23][0-9a-f]{64}") |
| 2968 | |
| 2969 | # After an htlc, we should get different results (two more commits) |
| 2970 | l1.pay(l2, 200000000) |
| 2971 | |
| 2972 | # Make sure both sides consider it completely settled (has received both |
| 2973 | # REVOKE_AND_ACK) |
| 2974 | l1.daemon.wait_for_logs([r"\[IN\] 0085"] * 2) |
| 2975 | l2.daemon.wait_for_logs([r"\[IN\] 0085"] * 2) |
| 2976 | |
| 2977 | l2.restart() |
| 2978 | |
| 2979 | # l1 should have sent WIRE_CHANNEL_REESTABLISH with extra fields. |
| 2980 | l1.daemon.wait_for_log(r"\[OUT\] 0088" |
| 2981 | # channel_id |
| 2982 | "[0-9a-f]{64}" |
| 2983 | # next_local_commitment_number |
| 2984 | "000000000000000[1-9]" |
| 2985 | # next_remote_revocation_number |
| 2986 | "000000000000000[1-9]" |
| 2987 | # your_last_per_commitment_secret |
| 2988 | "[0-9a-f]{64}" |
nothing calls this directly
no test coverage detected