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

Function test_multirpc

tests/test_misc.py:901–924  ·  view source on GitHub ↗

Test that we can do multiple RPC without waiting for response

(node_factory)

Source from the content-addressed store, hash-verified

899
900
901def 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
927def test_multiplexed_rpc(node_factory):

Callers

nothing calls this directly

Calls 6

connect_unixFunction · 0.85
sendallMethod · 0.80
joinMethod · 0.80
_readobjMethod · 0.80
get_nodeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected