l2 restarts while it is pondering what to do with an HTLC.
(node_factory, executor)
| 1268 | |
| 1269 | |
| 1270 | def test_htlc_accepted_hook_direct_restart(node_factory, executor): |
| 1271 | """l2 restarts while it is pondering what to do with an HTLC. |
| 1272 | """ |
| 1273 | l1, l2 = node_factory.line_graph(2, opts=[ |
| 1274 | {'may_reconnect': True}, |
| 1275 | {'may_reconnect': True, |
| 1276 | 'plugin': os.path.join(os.getcwd(), 'tests/plugins/hold_htlcs.py')} |
| 1277 | ]) |
| 1278 | |
| 1279 | i1 = l2.rpc.invoice(amount_msat=1000, label="direct", description="desc")['bolt11'] |
| 1280 | f1 = executor.submit(l1.rpc.xpay, i1) |
| 1281 | |
| 1282 | l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds') |
| 1283 | |
| 1284 | # Check that the status mentions the HTLC being held |
| 1285 | l2.rpc.listpeers() |
| 1286 | channel = only_one(l2.rpc.listpeerchannels()['channels']) |
| 1287 | htlc_status = channel['htlcs'][0].get('status', None) |
| 1288 | assert htlc_status == "Waiting for the htlc_accepted hook of plugin hold_htlcs.py" |
| 1289 | |
| 1290 | needle = l2.daemon.logsearch_start |
| 1291 | l2.restart() |
| 1292 | |
| 1293 | # Now it should try again, *after* initializing. |
| 1294 | # This may be before "Server started with public key" swallowed by restart() |
| 1295 | l2.daemon.logsearch_start = needle + 1 |
| 1296 | l2.daemon.wait_for_log(r'hold_htlcs.py initializing') |
| 1297 | l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds') |
| 1298 | f1.result() |
| 1299 | |
| 1300 | |
| 1301 | def test_htlc_accepted_hook_restart_during_shutdown(node_factory, executor): |
nothing calls this directly
no test coverage detected