-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore message false positive (#59)
* fix: ignore message false positive This PR changes the `toString` encoding of message `seqno` to 'hex' so that a unique key is generated by `utils.msgId` for caching messages. Converting the `seqno` to a utf8 string can sometimes result in the same string for different buffers. The following are two different seqno's that `js-ipfs` was sent from `go-ipfs` that demonstrates the problem: ```console $ node > const buf2 = Buffer.from('15603533e990dfe0', 'hex') > const buf1 = Buffer.from('15603533e990dfde', 'hex') > buf1.toString('utf8') '\u0015`53���' > buf2.toString('utf8') '\u0015`53���' > buf1.toString('utf8') === buf2.toString('utf8') true > ``` So sometimes we think we've seen the message when we haven't! 🤦♂️ License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai> * fix: jsdoc for randomSeqno License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
- Loading branch information
1 parent
c4a108d
commit 55916fe
Showing
3 changed files
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters