Test multiple channels between same nodes
(node_factory, executor, bitcoind)
| 3895 | @pytest.mark.openchannel('v2') |
| 3896 | @pytest.mark.developer("dev-no-reconnect required") |
| 3897 | def test_multichan_stress(node_factory, executor, bitcoind): |
| 3898 | """Test multiple channels between same nodes""" |
| 3899 | l1, l2, l3 = node_factory.line_graph(3, opts={'may_reconnect': True, |
| 3900 | 'dev-no-reconnect': None}) |
| 3901 | |
| 3902 | # Now fund *second* channel l2->l3 (slightly larger) |
| 3903 | bitcoind.rpc.sendtoaddress(l2.rpc.newaddr()['bech32'], 0.1) |
| 3904 | bitcoind.generate_block(1) |
| 3905 | sync_blockheight(bitcoind, [l2]) |
| 3906 | l2.rpc.fundchannel(l3.info['id'], '0.01001btc') |
| 3907 | assert(len(only_one(l2.rpc.listpeers(l3.info['id'])['peers'])['channels']) == 2) |
| 3908 | assert(len(only_one(l3.rpc.listpeers(l2.info['id'])['peers'])['channels']) == 2) |
| 3909 | |
| 3910 | # Make sure gossip works. |
| 3911 | bitcoind.generate_block(6, wait_for_mempool=1) |
| 3912 | wait_for(lambda: len(l1.rpc.listchannels(source=l3.info['id'])['channels']) == 2) |
| 3913 | |
| 3914 | def send_many_payments(): |
| 3915 | for i in range(30): |
| 3916 | inv = l3.rpc.invoice(100, "label-" + str(i), "desc")['bolt11'] |
| 3917 | try: |
| 3918 | l1.rpc.pay(inv) |
| 3919 | except RpcError: |
| 3920 | pass |
| 3921 | |
| 3922 | # Send a heap of payments, while reconnecting... |
| 3923 | fut = executor.submit(send_many_payments) |
| 3924 | |
| 3925 | for i in range(10): |
| 3926 | l3.rpc.disconnect(l2.info['id'], force=True) |
| 3927 | l3.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 3928 | fut.result(TIMEOUT) |
| 3929 | |
| 3930 | wait_for(lambda: only_one(l3.rpc.listpeers(l2.info['id'])['peers'])['connected']) |
| 3931 | inv = l3.rpc.invoice(50000000, "invoice4", "invoice4") |
| 3932 | l1.rpc.pay(inv['bolt11']) |
| 3933 | |
| 3934 | |
| 3935 | @pytest.mark.developer("dev-no-reconnect required") |
nothing calls this directly
no test coverage detected