fix: content topic in wakuv2
This commit is contained in:
parent
d4d35710be
commit
b14de2dd9d
|
@ -152,9 +152,16 @@ type MemoryMessageStore struct {
|
|||
}
|
||||
|
||||
func NewReceivedMessage(env *protocol.Envelope, msgType MessageType) *ReceivedMessage {
|
||||
ct, err := ExtractTopicFromContentTopic(env.Message().ContentTopic)
|
||||
if err != nil {
|
||||
ct = new(TopicType)
|
||||
}
|
||||
|
||||
return &ReceivedMessage{
|
||||
Envelope: env,
|
||||
MsgType: msgType,
|
||||
Sent: uint32(env.Message().Timestamp / int64(time.Second)),
|
||||
Topic: *ct,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +234,14 @@ func (msg *ReceivedMessage) Open(watcher *Filter) (result *ReceivedMessage) {
|
|||
result.Src = raw.PubKey
|
||||
|
||||
result.Sent = uint32(msg.Envelope.Message().Timestamp / int64(time.Second))
|
||||
result.Topic = StringToTopic(msg.Envelope.Message().ContentTopic)
|
||||
|
||||
ct, err := ExtractTopicFromContentTopic(msg.Envelope.Message().ContentTopic)
|
||||
if err != nil {
|
||||
log.Error("failed to decode message", "err", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
result.Topic = *ct
|
||||
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue