fix_: proper content topic conversion between transport and waku layer for setting criteria interest (#5758)
This commit is contained in:
parent
8914a79284
commit
36c893d3d2
|
@ -129,7 +129,7 @@ func (w *GethWakuWrapper) SubscribeToConnStatusChanges() (*types.ConnStatusSubsc
|
|||
return nil, errors.New("not available in WakuV1")
|
||||
}
|
||||
|
||||
func (w *GethWakuWrapper) SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []string) error {
|
||||
func (w *GethWakuWrapper) SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []types.TopicType) error {
|
||||
return errors.New("not available in WakuV1")
|
||||
}
|
||||
|
||||
|
|
|
@ -302,9 +302,13 @@ func (w *gethWakuV2Wrapper) SubscribeToConnStatusChanges() (*types.ConnStatusSub
|
|||
return w.waku.SubscribeToConnStatusChanges(), nil
|
||||
}
|
||||
|
||||
func (w *gethWakuV2Wrapper) SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []string) error {
|
||||
func (w *gethWakuV2Wrapper) SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []types.TopicType) error {
|
||||
var cTopics []string
|
||||
for _, ct := range contentTopics {
|
||||
cTopics = append(cTopics, wakucommon.TopicType(ct).ContentTopic())
|
||||
}
|
||||
pubsubTopic = w.waku.GetPubsubTopic(pubsubTopic)
|
||||
w.waku.SetTopicsToVerifyForMissingMessages(peerID, pubsubTopic, contentTopics)
|
||||
w.waku.SetTopicsToVerifyForMissingMessages(peerID, pubsubTopic, cTopics)
|
||||
|
||||
// No err can be be generated by this function. The function returns an error
|
||||
// Just so there's compatibility with GethWakuWrapper from V1
|
||||
|
|
|
@ -30,7 +30,7 @@ func BytesToTopic(b []byte) (t TopicType) {
|
|||
}
|
||||
|
||||
// String converts a topic byte array to a string representation.
|
||||
func (t *TopicType) String() string {
|
||||
func (t TopicType) String() string {
|
||||
return EncodeHex(t[:])
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ type Waku interface {
|
|||
|
||||
SubscribeToConnStatusChanges() (*ConnStatusSubscription, error)
|
||||
|
||||
SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []string) error
|
||||
SetCriteriaForMissingMessageVerification(peerID peer.ID, pubsubTopic string, contentTopics []TopicType) error
|
||||
|
||||
// MinPow returns the PoW value required by this node.
|
||||
MinPow() float64
|
||||
|
|
|
@ -752,7 +752,7 @@ func (t *Transport) SetCriteriaForMissingMessageVerification(peerID peer.ID, fil
|
|||
return
|
||||
}
|
||||
|
||||
topicMap := make(map[string]map[string]struct{})
|
||||
topicMap := make(map[string]map[types.TopicType]struct{})
|
||||
for _, f := range filters {
|
||||
if !f.Listen || f.Ephemeral {
|
||||
continue
|
||||
|
@ -760,10 +760,10 @@ func (t *Transport) SetCriteriaForMissingMessageVerification(peerID peer.ID, fil
|
|||
|
||||
_, ok := topicMap[f.PubsubTopic]
|
||||
if !ok {
|
||||
topicMap[f.PubsubTopic] = make(map[string]struct{})
|
||||
topicMap[f.PubsubTopic] = make(map[types.TopicType]struct{})
|
||||
}
|
||||
|
||||
topicMap[f.PubsubTopic][f.ContentTopic.String()] = struct{}{}
|
||||
topicMap[f.PubsubTopic][f.ContentTopic] = struct{}{}
|
||||
}
|
||||
|
||||
for pubsubTopic, contentTopics := range topicMap {
|
||||
|
@ -774,7 +774,7 @@ func (t *Transport) SetCriteriaForMissingMessageVerification(peerID peer.ID, fil
|
|||
zap.Error(err),
|
||||
zap.Stringer("peerID", peerID),
|
||||
zap.String("pubsubTopic", pubsubTopic),
|
||||
zap.Strings("contentTopics", ctList))
|
||||
zap.Stringers("contentTopics", ctList))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue