diff --git a/network/network.go b/network/network.go index c4e9c3a2c..e97d26a64 100644 --- a/network/network.go +++ b/network/network.go @@ -30,7 +30,6 @@ type network struct { // Adding these linter later: contextcheck and containedctx ctx context.Context cancel func() - name string config *Config host lp2phost.Host mdns *mdnsService @@ -198,7 +197,6 @@ func newNetwork(conf *Config, log *logger.SubLogger, opts []lp2p.Option) (*netwo n := &network{ ctx: ctx, cancel: cancel, - name: conf.NetworkName, config: conf, logger: log, host: host, @@ -208,8 +206,8 @@ func newNetwork(conf *Config, log *logger.SubLogger, opts []lp2p.Option) (*netwo log.SetObj(n) - kadProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/gossip/v1", n.name)) // TODO: better name? - streamProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/stream/v1", n.name)) + kadProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/gossip/v1", conf.NetworkName)) // TODO: better name? + streamProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/stream/v1", conf.NetworkName)) if conf.EnableMdns { n.mdns = newMdnsService(ctx, n.host, n.logger) @@ -333,7 +331,7 @@ func (n *network) consensusTopicName() string { } func (n *network) TopicName(topic string) string { - return fmt.Sprintf("/%s/topic/%s/v1", n.name, topic) + return fmt.Sprintf("/%s/topic/%s/v1", n.config.NetworkName, topic) } func (n *network) CloseConnection(pid lp2ppeer.ID) { diff --git a/tests/main_test.go b/tests/main_test.go index 94ab8d846..648006e67 100644 --- a/tests/main_test.go +++ b/tests/main_test.go @@ -68,7 +68,7 @@ func TestMain(m *testing.M) { tValKeys[i][0] = bls.NewValidatorKey(key0) tValKeys[i][1] = bls.NewValidatorKey(key1) tValKeys[i][2] = bls.NewValidatorKey(key2) - tConfigs[i] = config.DefaultConfigLocalnet() + tConfigs[i] = config.DefaultConfigMainnet() tConfigs[i].Store.Path = util.TempDirPath() tConfigs[i].Consensus.ChangeProposerTimeout = 4 * time.Second @@ -83,17 +83,20 @@ func TestMain(m *testing.M) { tConfigs[i].Sync.Firewall.Enabled = false tConfigs[i].Network.EnableMdns = true tConfigs[i].Network.ForcePrivateNetwork = true - tConfigs[i].Network.Bootstrapper = true + tConfigs[i].Network.Bootstrapper = false tConfigs[i].Network.NetworkKey = util.TempFilePath() + tConfigs[i].Network.NetworkName = "test" tConfigs[i].Network.ListenAddrStrings = []string{"/ip4/127.0.0.1/tcp/0", "/ip4/127.0.0.1/udp/0/quic-v1"} tConfigs[i].Network.BootstrapAddrStrings = []string{} - tConfigs[i].Network.MinConns = 3 + tConfigs[i].Network.MinConns = 4 + tConfigs[i].Network.MaxConns = 8 tConfigs[i].HTTP.Enable = false tConfigs[i].GRPC.Enable = false sync.LatestBlockInterval = 10 if i == 0 { + tConfigs[i].Network.Bootstrapper = true tConfigs[i].Sync.NodeNetwork = true tConfigs[i].GRPC.Enable = true tConfigs[i].GRPC.Listen = tGRPCAddress