Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
e07e507d
Commit
e07e507d
authored
Aug 13, 2018
by
Eugene Valeyev
Committed by
Guillaume Ballet
Aug 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whisper: fixed broken partial topic filtering
Changes in #15811 broke partial topic filtering. Re-enable it.
parent
d8328a96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
58 deletions
+5
-58
filter.go
whisper/whisperv5/filter.go
+1
-1
filter_test.go
whisper/whisperv5/filter_test.go
+4
-4
filter.go
whisper/whisperv6/filter.go
+0
-17
filter_test.go
whisper/whisperv6/filter_test.go
+0
-36
No files found.
whisper/whisperv5/filter.go
View file @
e07e507d
...
...
@@ -220,7 +220,7 @@ func matchSingleTopic(topic TopicType, bt []byte) bool {
bt
=
bt
[
:
TopicLength
]
}
if
len
(
bt
)
<
TopicLength
{
if
len
(
bt
)
==
0
{
return
false
}
...
...
whisper/whisperv5/filter_test.go
View file @
e07e507d
...
...
@@ -829,16 +829,16 @@ func TestMatchSingleTopic_WithTail_ReturnTrue(t *testing.T) {
}
}
func
TestMatchSingleTopic_
NotEquals_ReturnFals
e
(
t
*
testing
.
T
)
{
func
TestMatchSingleTopic_
PartialTopic_ReturnTru
e
(
t
*
testing
.
T
)
{
bt
:=
[]
byte
(
"tes"
)
topic
:=
BytesToTopic
(
bt
)
topic
:=
BytesToTopic
(
[]
byte
(
"test"
)
)
if
matchSingleTopic
(
topic
,
bt
)
{
if
!
matchSingleTopic
(
topic
,
bt
)
{
t
.
FailNow
()
}
}
func
TestMatchSingleTopic_
InsufficientLength
_ReturnFalse
(
t
*
testing
.
T
)
{
func
TestMatchSingleTopic_
NotEquals
_ReturnFalse
(
t
*
testing
.
T
)
{
bt
:=
[]
byte
(
"test"
)
topic
:=
BytesToTopic
([]
byte
(
"not_equal"
))
...
...
whisper/whisperv6/filter.go
View file @
e07e507d
...
...
@@ -250,23 +250,6 @@ func (f *Filter) MatchEnvelope(envelope *Envelope) bool {
return
f
.
PoW
<=
0
||
envelope
.
pow
>=
f
.
PoW
}
func
matchSingleTopic
(
topic
TopicType
,
bt
[]
byte
)
bool
{
if
len
(
bt
)
>
TopicLength
{
bt
=
bt
[
:
TopicLength
]
}
if
len
(
bt
)
<
TopicLength
{
return
false
}
for
j
,
b
:=
range
bt
{
if
topic
[
j
]
!=
b
{
return
false
}
}
return
true
}
// IsPubKeyEqual checks that two public keys are equal
func
IsPubKeyEqual
(
a
,
b
*
ecdsa
.
PublicKey
)
bool
{
if
!
ValidatePublicKey
(
a
)
{
...
...
whisper/whisperv6/filter_test.go
View file @
e07e507d
...
...
@@ -829,39 +829,3 @@ func TestVariableTopics(t *testing.T) {
}
}
}
func
TestMatchSingleTopic_ReturnTrue
(
t
*
testing
.
T
)
{
bt
:=
[]
byte
(
"test"
)
topic
:=
BytesToTopic
(
bt
)
if
!
matchSingleTopic
(
topic
,
bt
)
{
t
.
FailNow
()
}
}
func
TestMatchSingleTopic_WithTail_ReturnTrue
(
t
*
testing
.
T
)
{
bt
:=
[]
byte
(
"test with tail"
)
topic
:=
BytesToTopic
([]
byte
(
"test"
))
if
!
matchSingleTopic
(
topic
,
bt
)
{
t
.
FailNow
()
}
}
func
TestMatchSingleTopic_NotEquals_ReturnFalse
(
t
*
testing
.
T
)
{
bt
:=
[]
byte
(
"tes"
)
topic
:=
BytesToTopic
(
bt
)
if
matchSingleTopic
(
topic
,
bt
)
{
t
.
FailNow
()
}
}
func
TestMatchSingleTopic_InsufficientLength_ReturnFalse
(
t
*
testing
.
T
)
{
bt
:=
[]
byte
(
"test"
)
topic
:=
BytesToTopic
([]
byte
(
"not_equal"
))
if
matchSingleTopic
(
topic
,
bt
)
{
t
.
FailNow
()
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment