Test that we handle the case where we completely resolve incoming htlc before fulfilled outgoing htlc
(node_factory, bitcoind)
| 3114 | |
| 3115 | @pytest.mark.developer("needs dev_disconnect") |
| 3116 | def test_fulfill_incoming_first(node_factory, bitcoind): |
| 3117 | """Test that we handle the case where we completely resolve incoming htlc |
| 3118 | before fulfilled outgoing htlc""" |
| 3119 | |
| 3120 | # We agree on fee change first, then add HTLC, then remove; stop after remove. |
| 3121 | disconnects = ['+WIRE_COMMITMENT_SIGNED*3'] |
| 3122 | # We manually reconnect l2 & l3, after 100 blocks; hence allowing manual |
| 3123 | # reconnect, but disabling auto connect, and massive cltv so 2/3 doesn't |
| 3124 | # time out. |
| 3125 | l1, l2, l3 = node_factory.line_graph(3, opts=[{'disable-mpp': None}, |
| 3126 | {'may_reconnect': True, |
| 3127 | 'dev-no-reconnect': None}, |
| 3128 | {'may_reconnect': True, |
| 3129 | 'dev-no-reconnect': None, |
| 3130 | 'disconnect': disconnects, |
| 3131 | 'cltv-final': 200}], |
| 3132 | wait_for_announce=True) |
| 3133 | |
| 3134 | # This succeeds. |
| 3135 | l1.rpc.pay(l3.rpc.invoice(200000000, 'test_fulfill_incoming_first', 'desc')['bolt11']) |
| 3136 | |
| 3137 | # l1 can shutdown, fine. |
| 3138 | l1.rpc.close(l2.info['id']) |
| 3139 | l1.wait_for_channel_onchain(l2.info['id']) |
| 3140 | bitcoind.generate_block(100) |
| 3141 | l2.daemon.wait_for_log('onchaind complete, forgetting peer') |
| 3142 | |
| 3143 | # Now, l2 should restore from DB fine, even though outgoing HTLC no longer |
| 3144 | # has an incoming. |
| 3145 | l2.restart() |
| 3146 | |
| 3147 | # Manually reconnect l2->l3. |
| 3148 | l2.rpc.connect(l3.info['id'], 'localhost', l3.port) |
| 3149 | |
| 3150 | # Fulfill should be retransmitted OK (ignored result). |
| 3151 | l2.rpc.close(l3.info['id']) |
| 3152 | l2.wait_for_channel_onchain(l3.info['id']) |
| 3153 | bitcoind.generate_block(100) |
| 3154 | l2.daemon.wait_for_log('onchaind complete, forgetting peer') |
| 3155 | l3.daemon.wait_for_log('onchaind complete, forgetting peer') |
| 3156 | |
| 3157 | |
| 3158 | @pytest.mark.skip('needs blackhold support') |
nothing calls this directly
no test coverage detected