Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

fix: allow topicCIDs from older peers #631

Merged
merged 1 commit into from
Nov 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module.exports = (arg) => {
function subscribe (topic, options, handler, callback) {
ps.on(topic, handler)
if (subscriptions[topic]) {
// TODO: should a callback error be returned?
return callback()
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/pubsub-message-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ function deserializeFromBase64 (obj) {
from: bs58.encode(Buffer.from(obj.from, 'base64')).toString(),
seqno: Buffer.from(obj.seqno, 'base64'),
data: Buffer.from(obj.data, 'base64'),
topicIDs: obj.topicIDs
topicIDs: obj.topicIDs || obj.topicCIDs
}
}

function isPubsubMessage (obj) {
return obj && obj.from && obj.seqno && obj.data && obj.topicIDs
return obj && obj.from && obj.seqno && obj.data && (obj.topicIDs || obj.topicCIDs)
}