Test that we can do multiple RPC without waiting for response
(node_factory)
| 899 | |
| 900 | |
| 901 | def test_multirpc(node_factory): |
| 902 | """Test that we can do multiple RPC without waiting for response""" |
| 903 | l1 = node_factory.get_node() |
| 904 | |
| 905 | sock = connect_unix(l1.rpc.socket_path) |
| 906 | |
| 907 | commands = [ |
| 908 | b'{"id":1,"jsonrpc":"2.0","method":"listpeers","params":[]}', |
| 909 | b'{"id":2,"jsonrpc":"2.0","method":"listpeers","params":[]}', |
| 910 | b'{"id":3,"jsonrpc":"2.0","method":"listpeers","params":[]}', |
| 911 | b'{"id":4,"jsonrpc":"2.0","method":"listpeers","params":[]}', |
| 912 | b'{"id":5,"jsonrpc":"2.0","method":"listpeers","params":[]}', |
| 913 | b'{"id":6,"jsonrpc":"2.0","method":"listpeers","params":[]}', |
| 914 | b'{"method": "invoice", "params": [100, "foo", "foo"], "jsonrpc": "2.0", "id": 7 }', |
| 915 | b'{"method": "waitinvoice", "params": ["foo"], "jsonrpc" : "2.0", "id": 8 }', |
| 916 | b'{"method": "delinvoice", "params": ["foo", "unpaid"], "jsonrpc" : "2.0", "id": 9 }', |
| 917 | ] |
| 918 | |
| 919 | sock.sendall(b'\n'.join(commands)) |
| 920 | |
| 921 | buff = b'' |
| 922 | for i in commands: |
| 923 | _, buff = l1.rpc._readobj(sock, buff) |
| 924 | sock.close() |
| 925 | |
| 926 | |
| 927 | def test_multiplexed_rpc(node_factory): |