create transport and perform handshake before creating Peer
This commit is contained in:
@@ -113,6 +113,9 @@ class MockTransport:
|
||||
def __init__(self):
|
||||
self.queue = asyncio.Queue()
|
||||
|
||||
def name(self):
|
||||
return ""
|
||||
|
||||
async def read_messages(self):
|
||||
while True:
|
||||
yield await self.queue.get()
|
||||
@@ -150,7 +153,7 @@ class TestPeer(unittest.TestCase):
|
||||
def test_require_data_loss_protect(self):
|
||||
mock_lnworker = MockLNWorker(keypair(), keypair(), self.alice_channel, tx_queue=None)
|
||||
mock_transport = NoFeaturesTransport()
|
||||
p1 = Peer(mock_lnworker, LNPeerAddr("bogus", 1337, b"\x00" * 33), request_initial_sync=False, transport=mock_transport)
|
||||
p1 = Peer(mock_lnworker, b"\x00" * 33, mock_transport, request_initial_sync=False)
|
||||
mock_lnworker.peer = p1
|
||||
with self.assertRaises(LightningPeerConnectionClosed):
|
||||
run(asyncio.wait_for(p1._main_loop(), 1))
|
||||
@@ -161,10 +164,8 @@ class TestPeer(unittest.TestCase):
|
||||
q1, q2 = asyncio.Queue(), asyncio.Queue()
|
||||
w1 = MockLNWorker(k1, k2, self.alice_channel, tx_queue=q1)
|
||||
w2 = MockLNWorker(k2, k1, self.bob_channel, tx_queue=q2)
|
||||
p1 = Peer(w1, LNPeerAddr("bogus1", 1337, k1.pubkey),
|
||||
request_initial_sync=False, transport=t1)
|
||||
p2 = Peer(w2, LNPeerAddr("bogus2", 1337, k2.pubkey),
|
||||
request_initial_sync=False, transport=t2)
|
||||
p1 = Peer(w1, k1.pubkey, t1, request_initial_sync=False)
|
||||
p2 = Peer(w2, k2.pubkey, t2, request_initial_sync=False)
|
||||
w1.peer = p1
|
||||
w2.peer = p2
|
||||
# mark_open won't work if state is already OPEN.
|
||||
|
||||
Reference in New Issue
Block a user