l2 restarts while it is pondering what to do with an HTLC.
(node_factory, executor)
| 1451 | |
| 1452 | |
| 1453 | def test_htlc_accepted_hook_forward_restart(node_factory, executor): |
| 1454 | """l2 restarts while it is pondering what to do with an HTLC. |
| 1455 | """ |
| 1456 | l1, l2, l3 = node_factory.line_graph(3, opts=[ |
| 1457 | {'may_reconnect': True}, |
| 1458 | {'may_reconnect': True, |
| 1459 | 'plugin': os.path.join(os.getcwd(), 'tests/plugins/hold_htlcs.py')}, |
| 1460 | {'may_reconnect': True}, |
| 1461 | ], wait_for_announce=True) |
| 1462 | |
| 1463 | i1 = l3.rpc.invoice(amount_msat=1000, label="direct", description="desc")['bolt11'] |
| 1464 | f1 = executor.submit(l1.dev_pay, i1, dev_use_shadow=False) |
| 1465 | |
| 1466 | l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds') |
| 1467 | |
| 1468 | needle = l2.daemon.logsearch_start |
| 1469 | l2.restart() |
| 1470 | |
| 1471 | # Now it should try again, *after* initializing. |
| 1472 | # This may be before "Server started with public key" swallowed by restart() |
| 1473 | l2.daemon.logsearch_start = needle + 1 |
| 1474 | l2.daemon.wait_for_log(r'hold_htlcs.py initializing') |
| 1475 | l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds') |
| 1476 | |
| 1477 | # Grab the file where the plugin wrote the onion and read it in for some |
| 1478 | # additional checks |
| 1479 | logline = l2.daemon.wait_for_log(r'Onion written to') |
| 1480 | fname = re.search(r'Onion written to (.*\.json)', logline).group(1) |
| 1481 | with open(fname) as f: |
| 1482 | onion = json.load(f) |
| 1483 | assert onion['type'] == 'tlv' |
| 1484 | assert re.match(r'^11020203e80401..0608................$', onion['payload']) |
| 1485 | assert len(onion['shared_secret']) == 64 |
| 1486 | assert onion['forward_msat'] == Millisatoshi(1000) |
| 1487 | assert len(onion['next_onion']) == 2 * (1300 + 32 + 33 + 1) |
| 1488 | |
| 1489 | f1.result() |
| 1490 | |
| 1491 | |
| 1492 | def test_warning_notification(node_factory): |
nothing calls this directly
no test coverage detected