|
@ -36,16 +36,17 @@ func TestRouter(t *testing.T) { |
|
|
logger := log.TestingLogger() |
|
|
logger := log.TestingLogger() |
|
|
network := p2p.NewMemoryNetwork(logger) |
|
|
network := p2p.NewMemoryNetwork(logger) |
|
|
transport := network.GenerateTransport() |
|
|
transport := network.GenerateTransport() |
|
|
|
|
|
defer transport.Close() |
|
|
chID := p2p.ChannelID(1) |
|
|
chID := p2p.ChannelID(1) |
|
|
|
|
|
|
|
|
// Start some other in-memory network nodes to communicate with, running
|
|
|
// Start some other in-memory network nodes to communicate with, running
|
|
|
// a simple echo reactor that returns received messages.
|
|
|
// a simple echo reactor that returns received messages.
|
|
|
peers := []p2p.PeerAddress{} |
|
|
peers := []p2p.PeerAddress{} |
|
|
for i := 0; i < 3; i++ { |
|
|
for i := 0; i < 3; i++ { |
|
|
i := i |
|
|
|
|
|
peerManager, err := p2p.NewPeerManager(dbm.NewMemDB(), p2p.PeerManagerOptions{}) |
|
|
peerManager, err := p2p.NewPeerManager(dbm.NewMemDB(), p2p.PeerManagerOptions{}) |
|
|
require.NoError(t, err) |
|
|
require.NoError(t, err) |
|
|
peerTransport := network.GenerateTransport() |
|
|
peerTransport := network.GenerateTransport() |
|
|
|
|
|
defer peerTransport.Close() |
|
|
peerRouter := p2p.NewRouter( |
|
|
peerRouter := p2p.NewRouter( |
|
|
logger.With("peerID", i), |
|
|
logger.With("peerID", i), |
|
|
peerManager, |
|
|
peerManager, |
|
|