From 4691b2b809e2aca7848eb7b545ebe9bfc9ddd6a5 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Fri, 4 Feb 2022 12:15:01 +0400 Subject: [PATCH] changes to the indexer message relay PR --- build/params_shared_funcs.go | 4 +++- node/modules/lp2p/pubsub.go | 2 +- node/modules/services.go | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build/params_shared_funcs.go b/build/params_shared_funcs.go index 9d5dfa347..f03a35fec 100644 --- a/build/params_shared_funcs.go +++ b/build/params_shared_funcs.go @@ -13,7 +13,9 @@ import ( func BlocksTopic(netName dtypes.NetworkName) string { return "/fil/blocks/" + string(netName) } func MessagesTopic(netName dtypes.NetworkName) string { return "/fil/msgs/" + string(netName) } -func IngestTopic(netName dtypes.NetworkName) string { return "/indexer/ingest/" + string(netName) } +func IndexerIngestTopic(netName dtypes.NetworkName) string { + return "/indexer/ingest/" + string(netName) +} func DhtProtocolName(netName dtypes.NetworkName) protocol.ID { return protocol.ID("/fil/kad/" + string(netName)) } diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 8fa005fcd..14f100450 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -333,7 +333,7 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { allowTopics := []string{ build.BlocksTopic(in.Nn), build.MessagesTopic(in.Nn), - build.IngestTopic(in.Nn), + build.IndexerIngestTopic(in.Nn), } allowTopics = append(allowTopics, drandTopics...) options = append(options, diff --git a/node/modules/services.go b/node/modules/services.go index d3b01ac6b..d0095075d 100644 --- a/node/modules/services.go +++ b/node/modules/services.go @@ -199,12 +199,12 @@ func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub } func RelayIndexerMessages(lc fx.Lifecycle, ps *pubsub.PubSub, nn dtypes.NetworkName, h host.Host) error { - topicName := build.IngestTopic(nn) + topicName := build.IndexerIngestTopic(nn) v := sub.NewIndexerMessageValidator(h.ID()) if err := ps.RegisterTopicValidator(topicName, v.Validate); err != nil { - panic(err) + return xerrors.Errorf("failed to register validator for topic %s, err: %w", topicName, err) } topicHandle, err := ps.Join(topicName)