(node_factory)
| 6181 | |
| 6182 | |
| 6183 | def test_enableoffer(node_factory): |
| 6184 | l1, l2 = node_factory.line_graph(2) |
| 6185 | |
| 6186 | # Normal offer, works as expected |
| 6187 | offer1 = l2.rpc.call('offer', {'amount': '2msat', |
| 6188 | 'description': 'test_disableoffer_reenable'}) |
| 6189 | assert offer1['created'] is True |
| 6190 | l1.rpc.fetchinvoice(offer=offer1['bolt12']) |
| 6191 | |
| 6192 | l2.rpc.disableoffer(offer_id=offer1['offer_id']) |
| 6193 | |
| 6194 | with pytest.raises(RpcError, match="Offer no longer available"): |
| 6195 | l1.rpc.fetchinvoice(offer=offer1['bolt12']) |
| 6196 | |
| 6197 | with pytest.raises(RpcError, match="1000.*Already exists, but isn't active"): |
| 6198 | l2.rpc.call('offer', {'amount': '2msat', |
| 6199 | 'description': 'test_disableoffer_reenable'}) |
| 6200 | |
| 6201 | l2.rpc.enableoffer(offer_id=offer1['offer_id']) |
| 6202 | l1.rpc.fetchinvoice(offer=offer1['bolt12']) |
| 6203 | |
| 6204 | # Can't enable twice. |
| 6205 | with pytest.raises(RpcError, match="1006.*offer already active"): |
| 6206 | l2.rpc.enableoffer(offer_id=offer1['offer_id']) |
| 6207 | |
| 6208 | # Can't enable unknown. |
| 6209 | with pytest.raises(RpcError, match="Unknown offer"): |
| 6210 | l1.rpc.enableoffer(offer_id=offer1['offer_id']) |
| 6211 | |
| 6212 | |
| 6213 | def test_offer_with_private_channels_multyhop2(node_factory): |
nothing calls this directly
no test coverage detected