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

Commit

Permalink
fix: allow topicCIDs from older peers (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider authored and daviddias committed Nov 20, 2017
1 parent 5782b2d commit fe7cc22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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)
}

0 comments on commit fe7cc22

Please sign in to comment.