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

Function test_privatechan

tests/test_renepay.py:737–774  ·  view source on GitHub ↗

Topology: 1----2----3----4 Tests if a payment can get through a private channel.

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

735
736
737def test_privatechan(node_factory, bitcoind):
738 """
739 Topology:
740 1----2----3----4
741 Tests if a payment can get through a private channel.
742 """
743 opts = [
744 {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 0, 'allow-deprecated-apis': True},
745 {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 0, 'allow-deprecated-apis': True},
746 {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 100, 'allow-deprecated-apis': True},
747 {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 0, 'allow-deprecated-apis': True},
748 ]
749 l1, l2, l3, l4 = node_factory.get_nodes(4, opts=opts)
750
751 l1.rpc.connect(l2.info["id"], "localhost", l2.port)
752 l2.rpc.connect(l3.info["id"], "localhost", l3.port)
753 l3.rpc.connect(l4.info["id"], "localhost", l4.port)
754
755 c12, _ = l1.fundchannel(l2, 10**6)
756 c23, _ = l2.fundchannel(l3, 10**6)
757 c34, _ = l3.fundchannel(l4, 10**6, announce_channel=False)
758
759 mine_funding_to_announce(bitcoind, [l1, l2, l3, l4])
760 l1.wait_channel_active(c12)
761 l2.wait_channel_active(c23)
762 l3.wait_local_channel_active(c34)
763
764 wait_for(lambda: len(l1.rpc.listchannels()["channels"]) == 4)
765 wait_for(lambda: len(l2.rpc.listchannels()["channels"]) == 4)
766 wait_for(lambda: len(l3.rpc.listchannels()["channels"]) == 4)
767 wait_for(lambda: len(l4.rpc.listchannels()["channels"]) == 4)
768
769 inv = l4.rpc.invoice("1000sat", "inv", "description")
770
771 l1.rpc.call("renepay", {"invstring": inv["bolt11"]})
772 l1.wait_for_htlcs()
773 invoice = only_one(l4.rpc.listinvoices("inv")["invoices"])
774 assert invoice["amount_received_msat"] >= Millisatoshi("1000sat")
775
776
777@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "broken for some reason")

Callers

nothing calls this directly

Calls 14

mine_funding_to_announceFunction · 0.90
wait_forFunction · 0.90
only_oneFunction · 0.90
MillisatoshiClass · 0.90
get_nodesMethod · 0.80
wait_channel_activeMethod · 0.80
wait_for_htlcsMethod · 0.80
connectMethod · 0.45
fundchannelMethod · 0.45
listchannelsMethod · 0.45
invoiceMethod · 0.45

Tested by

no test coverage detected