Test that htlc_accepted plugin hook can replace payload
(node_factory)
| 2424 | |
| 2425 | |
| 2426 | def test_replacement_payload(node_factory): |
| 2427 | """Test that htlc_accepted plugin hook can replace payload""" |
| 2428 | plugin = os.path.join(os.path.dirname(__file__), 'plugins/replace_payload.py') |
| 2429 | l1, l2 = node_factory.line_graph( |
| 2430 | 2, |
| 2431 | opts=[{}, {"plugin": plugin}], |
| 2432 | wait_for_announce=True |
| 2433 | ) |
| 2434 | |
| 2435 | # Replace with an invalid payload. |
| 2436 | l2.rpc.call('setpayload', ['0000']) |
| 2437 | inv = l2.rpc.invoice(123, 'test_replacement_payload', 'test_replacement_payload')['bolt11'] |
| 2438 | with pytest.raises(RpcError, match=r"Unexpected error \(invalid_onion_payload\) from final node"): |
| 2439 | l1.rpc.xpay(inv) |
| 2440 | |
| 2441 | # Replace with valid payload, but corrupt payment_secret |
| 2442 | l2.rpc.call('setpayload', ['corrupt_secret']) |
| 2443 | |
| 2444 | with pytest.raises(RpcError, match=r"Destination said it doesn't know invoice: incorrect_or_unknown_payment_details"): |
| 2445 | l1.rpc.xpay(inv) |
| 2446 | |
| 2447 | assert l2.daemon.wait_for_log("Attempt to pay.*with wrong payment_secret") |
| 2448 | |
| 2449 | |
| 2450 | def test_watchtower(node_factory, bitcoind, directory, chainparams): |
nothing calls this directly
no test coverage detected