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 53ab31a8d..f5117d75e 100644 --- a/internal/p2p/router.go +++ b/internal/p2p/router.go @@ -721,7 +721,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(), @@ -919,11 +919,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 { @@ -944,14 +939,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 209afb6bd..6fe6c50a0 100644 --- a/internal/p2p/router_test.go +++ b/internal/p2p/router_test.go @@ -156,7 +156,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. @@ -166,9 +165,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()