l1 uses the reject-payment plugin to reject invoices with odd preimages.
(node_factory)
| 687 | |
| 688 | |
| 689 | def test_invoice_payment_hook(node_factory): |
| 690 | """ l1 uses the reject-payment plugin to reject invoices with odd preimages. |
| 691 | """ |
| 692 | opts = [{}, {'plugin': os.path.join(os.getcwd(), 'tests/plugins/reject_some_invoices.py')}] |
| 693 | l1, l2 = node_factory.line_graph(2, opts=opts) |
| 694 | |
| 695 | # This one works |
| 696 | inv1 = l2.rpc.invoice(1230, 'label', 'description', preimage='1' * 64) |
| 697 | l1.rpc.xpay(inv1['bolt11']) |
| 698 | |
| 699 | l2.daemon.wait_for_log('label=label') |
| 700 | l2.daemon.wait_for_log('msat=') |
| 701 | l2.daemon.wait_for_log('preimage=' + '1' * 64) |
| 702 | |
| 703 | # This one will be rejected. |
| 704 | inv2 = l2.rpc.invoice(1230, 'label2', 'description', preimage='0' * 64) |
| 705 | with pytest.raises(RpcError, match=r'Unexpected error \(temporary_node_failure\) from final node'): |
| 706 | l1.rpc.xpay(inv2['bolt11']) |
| 707 | |
| 708 | l2.daemon.wait_for_log('label=label2') |
| 709 | l2.daemon.wait_for_log('msat=') |
| 710 | l2.daemon.wait_for_log('preimage=' + '0' * 64) |
| 711 | |
| 712 | |
| 713 | def test_invoice_payment_hook_hold(node_factory, executor): |
nothing calls this directly
no test coverage detected