diff --git a/internal/p2p/p2ptest/network.go b/internal/p2p/p2ptest/network.go index 73df1e47f..85df029d8 100644 --- a/internal/p2p/p2ptest/network.go +++ b/internal/p2p/p2ptest/network.go @@ -306,7 +306,6 @@ func (n *Node) MakeChannel( ctx, cancel := context.WithCancel(ctx) channel, err := n.Router.OpenChannel(ctx, chDesc) require.NoError(t, err) - require.Contains(t, n.Router.NodeInfo().Channels, byte(chDesc.ID)) t.Cleanup(func() { RequireEmpty(ctx, t, channel) cancel() diff --git a/internal/p2p/router.go b/internal/p2p/router.go index 830b0091c..df096dbb6 100644 --- a/internal/p2p/router.go +++ b/internal/p2p/router.go @@ -713,7 +713,7 @@ func (r *Router) handshakePeer( return peerInfo, fmt.Errorf("expected to connect with peer %q, got %q", expectID, peerInfo.NodeID) } - if err := r.nodeInfoProducer().CompatibleWith(peerInfo); err != nil { + if err := nodeInfo.CompatibleWith(peerInfo); err != nil { return peerInfo, ErrRejected{ err: err, id: peerInfo.ID(), @@ -911,11 +911,6 @@ func (r *Router) evictPeers(ctx context.Context) { } } -// NodeInfo returns a copy of the current NodeInfo. Used for testing. -func (r *Router) NodeInfo() types.NodeInfo { - return r.nodeInfoProducer().Copy() -} - func (r *Router) setupQueueFactory(ctx context.Context) error { qf, err := r.createQueueFactory(ctx) if err != nil { @@ -936,14 +931,6 @@ func (r *Router) OnStart(ctx context.Context) error { return err } - nodeInfo := r.nodeInfoProducer() - r.logger.Info( - "starting router", - "node_id", nodeInfo.NodeID, - "channels", nodeInfo.Channels, - "listen_addr", nodeInfo.ListenAddr, - ) - go r.dialPeers(ctx) go r.evictPeers(ctx) go r.acceptPeers(ctx, r.transport) diff --git a/internal/p2p/router_test.go b/internal/p2p/router_test.go index f578446e3..663e6b81c 100644 --- a/internal/p2p/router_test.go +++ b/internal/p2p/router_test.go @@ -128,7 +128,6 @@ func TestRouter_Channel_Basic(t *testing.T) { channel, err := router.OpenChannel(chctx, chDesc) require.NoError(t, err) - require.Contains(t, router.NodeInfo().Channels, byte(chDesc.ID)) require.NotNil(t, channel) // Opening the same channel again should fail. @@ -138,9 +137,7 @@ func TestRouter_Channel_Basic(t *testing.T) { // Opening a different channel should work. chDesc2 := &p2p.ChannelDescriptor{ID: 2, MessageType: &p2ptest.Message{}} _, err = router.OpenChannel(ctx, chDesc2) - require.NoError(t, err) - require.Contains(t, router.NodeInfo().Channels, byte(chDesc2.ID)) // Closing the channel, then opening it again should be fine. chcancel()