|
|
@ -77,8 +77,8 @@ class TestLNTransport(ElectrumTestCase): |
|
|
|
await group.spawn(read_messages(t, messages_sent_by_client)) |
|
|
|
await group.spawn(write_messages(t, messages_sent_by_server)) |
|
|
|
responder_shaked.set() |
|
|
|
async def connect(): |
|
|
|
peer_addr = LNPeerAddr('127.0.0.1', 42898, responder_key.get_public_key_bytes()) |
|
|
|
async def connect(port: int): |
|
|
|
peer_addr = LNPeerAddr('127.0.0.1', port, responder_key.get_public_key_bytes()) |
|
|
|
t = LNTransport(initiator_key.get_secret_bytes(), peer_addr, proxy=None) |
|
|
|
await t.handshake() |
|
|
|
async with OldTaskGroup() as group: |
|
|
@ -87,10 +87,11 @@ class TestLNTransport(ElectrumTestCase): |
|
|
|
server_shaked.set() |
|
|
|
|
|
|
|
async def f(): |
|
|
|
server = await asyncio.start_server(cb, '127.0.0.1', 42898) |
|
|
|
server = await asyncio.start_server(cb, '127.0.0.1', port=None) |
|
|
|
server_port = server.sockets[0].getsockname()[1] |
|
|
|
try: |
|
|
|
async with OldTaskGroup() as group: |
|
|
|
await group.spawn(connect()) |
|
|
|
await group.spawn(connect(port=server_port)) |
|
|
|
await group.spawn(responder_shaked.wait()) |
|
|
|
await group.spawn(server_shaked.wait()) |
|
|
|
finally: |
|
|
|