Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

feat: refactor validate #61

Merged
merged 2 commits into from
Jul 16, 2020

Conversation

wemeetagain
Copy link
Member

Builds off of #60
Resolves ChainSafe/js-libp2p-gossipsub#105

This is a breaking change as it changes the signature and behavior of validate to throw an error on invalid input, rather than return a boolean.

We can retain the single parameter, message, instead of also including a separate peerId param.
We do this by changing the type of message to InMessage, which attaches a receivedFrom property.

@vasco-santos
Copy link
Member

Can you rebase this?

BREAKING CHANGE: validate no longer returns a boolean, but throws an
error on invalid input.
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Just want to align on the error codes if we need to use them externally

src/index.js Outdated Show resolved Hide resolved
@vasco-santos vasco-santos merged commit d057eda into libp2p:v0.6.x Jul 16, 2020
@wemeetagain wemeetagain deleted the feat/refactor-validate branch July 21, 2020 14:56
vasco-santos pushed a commit that referenced this pull request Aug 11, 2020
* feat: refactor validate

BREAKING CHANGE: validate no longer returns a boolean, but throws an
error on invalid input.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants