From ba118a4d14cfb5562acde945309c7ee511ba9daa Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 20 May 2020 15:10:04 +0530 Subject: [PATCH] create subscriber first --- p2p/protocol/identify/id_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/p2p/protocol/identify/id_test.go b/p2p/protocol/identify/id_test.go index a2a533c6b9..4b79567f1a 100644 --- a/p2p/protocol/identify/id_test.go +++ b/p2p/protocol/identify/id_test.go @@ -49,6 +49,11 @@ func subtestIDService(t *testing.T) { defer ids1.Close() defer ids2.Close() + sub, err := ids1.Host.EventBus().Subscribe(new(event.EvtPeerIdentificationCompleted), eventbus.BufSize(16)) + if err != nil { + t.Fatal(err) + } + testKnowsAddrs(t, h1, h2p, []ma.Multiaddr{}) // nothing testKnowsAddrs(t, h2, h1p, []ma.Multiaddr{}) // nothing @@ -70,11 +75,6 @@ func subtestIDService(t *testing.T) { t.Fatal("should have a conn here") } - sub, err := ids1.Host.EventBus().Subscribe(new(event.EvtPeerIdentificationCompleted), eventbus.BufSize(16)) - if err != nil { - t.Fatal(err) - } - ids1.IdentifyConn(h1t2c[0]) // the IDService should be opened automatically, by the network.