MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_mpp_overload_payee

Function test_mpp_overload_payee

tests/test_pay.py:4355–4406  ·  view source on GitHub ↗

We had a bug where if the payer is unusually well-connected compared to the payee, the payee is unable to accept a large payment since the payer will split it into lots of tiny payments, which would choke the max-concurrent-htlcs limit of the payee.

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

4353
4354@pytest.mark.slow_test
4355def test_mpp_overload_payee(node_factory, bitcoind):
4356 """
4357 We had a bug where if the payer is unusually well-connected compared
4358 to the payee, the payee is unable to accept a large payment since the
4359 payer will split it into lots of tiny payments, which would choke the
4360 max-concurrent-htlcs limit of the payee.
4361 """
4362 # Default value as of this writing.
4363 # However, with anchor commitments we might be able to safely lift this
4364 # default limit in the future, so explicitly put this value here, since
4365 # that is what our test assumes.
4366 opts = {'max-concurrent-htlcs': 30}
4367
4368 l1, l2, l3, l4, l5, l6 = node_factory.get_nodes(6, opts=opts)
4369
4370 # Respect wumbo.
4371 # Using max-sized channels shows that the issue is not capacity
4372 # but rather max-concurrent-htlcs.
4373 # This is grade-school level.
4374 amt = 2**24 - 1
4375
4376 # Build the public network.
4377 # l1 is the very well-connected payer.
4378 # l2 is the poorly-connected payee.
4379 # l3->l6 are well-connected hop nodes.
4380 public_network = [l1.fundbalancedchannel(l3, amt),
4381 l1.fundbalancedchannel(l4, amt),
4382 l1.fundbalancedchannel(l5, amt),
4383 l1.fundbalancedchannel(l6, amt),
4384 l2.fundbalancedchannel(l6, amt),
4385 l3.fundbalancedchannel(l4, amt),
4386 l3.fundbalancedchannel(l5, amt),
4387 l3.fundbalancedchannel(l6, amt),
4388 l4.fundbalancedchannel(l5, amt),
4389 l5.fundbalancedchannel(l6, amt)]
4390
4391 # Ensure l1 knows the entire public network.
4392 mine_funding_to_announce(bitcoind, [l1, l2, l3, l4, l5, l6])
4393 for c in public_network:
4394 wait_for(lambda: len(l1.rpc.listchannels(c)['channels']) >= 2)
4395
4396 # Now create a 400,000-sat invoice.
4397 # This assumes the MPP presplitter strongly prefers to
4398 # create lot sizes of 10,000 sats each.
4399 # This leads the presplitter to prefer to split into
4400 # around 40 HTLCs of 10,000 sats each, but since
4401 # max-concurrent-htlcs is set to 30, l2 would be unable
4402 # to receive.
4403 inv = l2.rpc.invoice(Millisatoshi(400000 * 1000), 'i', 'i')['bolt11']
4404
4405 # pay.
4406 l1.rpc.pay(inv)
4407
4408
4409def test_offer(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 8

mine_funding_to_announceFunction · 0.90
wait_forFunction · 0.90
MillisatoshiClass · 0.90
get_nodesMethod · 0.80
fundbalancedchannelMethod · 0.80
listchannelsMethod · 0.45
invoiceMethod · 0.45
payMethod · 0.45

Tested by

no test coverage detected