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

Function test_xpay_no_mpp

tests/test_xpay.py:616–643  ·  view source on GitHub ↗

Suppress mpp, resulting in a single payment part

(node_factory, chainparams)

Source from the content-addressed store, hash-verified

614
615
616def test_xpay_no_mpp(node_factory, chainparams):
617 """Suppress mpp, resulting in a single payment part"""
618 l1, l2, l3, l4 = node_factory.get_nodes(4)
619 node_factory.join_nodes([l1, l2, l3], wait_for_announce=True)
620 node_factory.join_nodes([l1, l4, l3], wait_for_announce=True)
621
622 # Amount needs to be enought that it bothers splitting, but not
623 # so much that it can't pay without mpp.
624 AMOUNT = 500000000
625
626 # We create a version of this which doesn't support MPP
627 no_mpp = l3.rpc.invoice(AMOUNT, 'test_xpay_no_mpp2', 'test_xpay_no_mpp without mpp')
628 b11_no_mpp = subprocess.check_output(["devtools/bolt11-cli",
629 "encode",
630 # secret for l3
631 "79893b45d1e57cf2ebf302af91aa52c9e573f638a61a83c6e603a331b53f452c",
632 f"currency={chainparams['bip173_prefix']}",
633 f"p={no_mpp['payment_hash']}",
634 f"s={no_mpp['payment_secret']}",
635 f"d=Paying l3 without mpp",
636 f"amount={AMOUNT}"]).decode('utf-8').strip()
637
638 # This should not mpp!
639 ret = l1.rpc.xpay(b11_no_mpp)
640 assert ret['failed_parts'] == 0
641 assert ret['successful_parts'] == 1
642 assert ret['amount_msat'] == AMOUNT
643 assert ret['amount_sent_msat'] == AMOUNT + AMOUNT // 100000 + 1
644
645
646def test_xpay_bolt12_no_mpp(node_factory, chainparams):

Callers

nothing calls this directly

Calls 5

get_nodesMethod · 0.80
join_nodesMethod · 0.80
invoiceMethod · 0.45
decodeMethod · 0.45
xpayMethod · 0.45

Tested by

no test coverage detected