(node_factory, executor)
| 6025 | # CI is so slow under valgrind that this does not reach the ratelimit! |
| 6026 | @pytest.mark.slow_test |
| 6027 | def test_onionmessage_ratelimit(node_factory, executor): |
| 6028 | l1, l2 = node_factory.line_graph(2, fundchannel=False, |
| 6029 | opts={'allow_warning': True}) |
| 6030 | |
| 6031 | offer = l2.rpc.call('offer', {'amount': '2msat', |
| 6032 | 'description': 'simple test'}) |
| 6033 | |
| 6034 | # Hopefully we can do this fast enough to reach ratelimit! |
| 6035 | futs = [] |
| 6036 | for _ in range(8): |
| 6037 | futs.append(executor.submit(l1.rpc.fetchinvoice, offer=offer['bolt12'], timeout=10)) |
| 6038 | |
| 6039 | with pytest.raises(RpcError, match="Timeout waiting for response"): |
| 6040 | for f in futs: |
| 6041 | f.result(TIMEOUT) |
| 6042 | |
| 6043 | # Normally l2 gets upset, but actually l1 can get upset with replies! |
| 6044 | assert (l1.daemon.is_in_log('WARNING: Ratelimited onion_message: exceeded one per 250msec') |
| 6045 | or l2.daemon.is_in_log('WARNING: Ratelimited onion_message: exceeded one per 250msec')) |
| 6046 | |
| 6047 | # It will recover though! |
| 6048 | time.sleep(0.250) |
| 6049 | l1.rpc.fetchinvoice(offer['bolt12']) |
| 6050 | |
| 6051 | |
| 6052 | def test_offer_path_self(node_factory): |
nothing calls this directly
no test coverage detected