diff --git a/src/index.js b/src/index.js index ce3b4c7831..f5b13002fc 100644 --- a/src/index.js +++ b/src/index.js @@ -50,6 +50,12 @@ class PubsubBaseProtocol extends EventEmitter { this.peerId = this.libp2p.peerInfo.id } + /** + * If message signing should be required for incoming messages + * @type {boolean} + */ + this.strictSigning = options.strictSigning + /** * Map of topics to which peers are subscribed to * @@ -374,6 +380,9 @@ class PubsubBaseProtocol extends EventEmitter { if (err) return callback(err) callback(null, valid) }) + } else { + // The message is valid + nextTick(callback, null, true) } } } diff --git a/test/pubsub.spec.js b/test/pubsub.spec.js index 7f570376a1..dfff9c8c8b 100644 --- a/test/pubsub.spec.js +++ b/test/pubsub.spec.js @@ -103,11 +103,6 @@ describe('pubsub base protocol', () => { psA._buildMessage(message, (err, signedMessage) => { expect(err).to.not.exist() - // const bytesToSign = Buffer.concat([ - // SignPrefix, - // Message.encode(normalizeOutRpcMessage(message)) - // ]) - psA.validate(signedMessage, (err, verified) => { expect(verified).to.eql(true) done(err)