Skip to content

Commit 4bb7b49

Browse files
committed
pytest: test that we indeed do MPP even if not advertized.
Signed-off-by: Rusty Russell <[email protected]>
1 parent d881c3c commit 4bb7b49

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/test_xpay.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,3 +649,30 @@ def test_xpay_no_mpp(node_factory, chainparams):
649649
assert ret['successful_parts'] == 1
650650
assert ret['amount_msat'] == AMOUNT
651651
assert ret['amount_sent_msat'] == AMOUNT + AMOUNT // 100000 + 1
652+
653+
654+
def test_xpay_bolt12_no_mpp(node_factory, chainparams):
655+
"""We should not (yet!) avoid mpp if BOLT12 invoice doesn't say we should"""
656+
l1, l2, l3, l4 = node_factory.get_nodes(4, opts=[{}, {}, {'dev-force-features': -17}, {}])
657+
node_factory.join_nodes([l1, l2, l3], wait_for_announce=True)
658+
node_factory.join_nodes([l1, l4, l3], wait_for_announce=True)
659+
660+
# Amount needs to be enought that it bothers splitting, but not
661+
# so much that it can't pay without mpp.
662+
AMOUNT = 500000000
663+
664+
# l2 will advertize mpp, l3 won't.
665+
l2offer = l2.rpc.offer(AMOUNT, 'test_xpay_bolt12_no_mpp')
666+
invl2 = l1.rpc.fetchinvoice(l2offer['bolt12'])
667+
l3offer = l3.rpc.offer(AMOUNT, 'test_xpay_bolt12_no_mpp')
668+
invl3 = l1.rpc.fetchinvoice(l3offer['bolt12'])
669+
670+
assert l1.rpc.decode(invl2['invoice'])['invoice_features'] == "020000"
671+
assert l1.rpc.decode(invl3['invoice'])['invoice_features'] == ""
672+
673+
# This will MPP ANYWAY, even though MPP is not specified!
674+
ret = l1.rpc.xpay(invl3['invoice'])
675+
assert ret['failed_parts'] == 0
676+
assert ret['successful_parts'] == 2
677+
assert ret['amount_msat'] == AMOUNT
678+
assert ret['amount_sent_msat'] == AMOUNT + AMOUNT // 100000 + 1

0 commit comments

Comments
 (0)