Reproducer for https://github.com/ElementsProject/lightning/issues/6089 The issue is when the offer has the quantity_max and the parameter. In particular, in the fetchinvoice we forget to map the quantity parameter with the invoice request quantity field.
(node_factory)
| 5568 | |
| 5569 | |
| 5570 | def test_fetchinvoice_with_no_quantity(node_factory): |
| 5571 | """ |
| 5572 | Reproducer for https://github.com/ElementsProject/lightning/issues/6089 |
| 5573 | |
| 5574 | The issue is when the offer has the quantity_max and the parameter. |
| 5575 | |
| 5576 | In particular, in the fetchinvoice we forget to map the |
| 5577 | quantity parameter with the invoice request quantity field. |
| 5578 | """ |
| 5579 | l1, l2 = node_factory.line_graph(2, wait_for_announce=True) |
| 5580 | offer1 = l2.rpc.call('offer', {'amount': '2msat', |
| 5581 | 'description': 'simple test', |
| 5582 | 'quantity_max': 10}) |
| 5583 | |
| 5584 | assert offer1['created'] is True, f"offer created is {offer1['created']}" |
| 5585 | |
| 5586 | with pytest.raises(RpcError, match="quantity parameter required"): |
| 5587 | l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12']}) |
| 5588 | |
| 5589 | inv = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'quantity': 2}) |
| 5590 | inv = inv['invoice'] |
| 5591 | decode_inv = l2.rpc.decode(inv) |
| 5592 | assert decode_inv['invreq_quantity'] == 2, f'`invreq_quantity` in the invoice did not match, received {decode_inv["quantity"]}, expected 2' |
| 5593 | |
| 5594 | |
| 5595 | def test_invoice_pay_desc_with_quotes(node_factory): |
nothing calls this directly
no test coverage detected