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
564c8f3a
Unverified
Commit
564c8f3a
authored
Sep 06, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/bloombits: drop nil-matcher special case
parent
451ffdb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
matcher.go
core/bloombits/matcher.go
+2
-10
matcher_test.go
core/bloombits/matcher_test.go
+5
-0
No files found.
core/bloombits/matcher.go
View file @
564c8f3a
...
...
@@ -17,6 +17,7 @@
package
bloombits
import
(
"bytes"
"errors"
"math"
"sort"
...
...
@@ -171,15 +172,6 @@ func (m *Matcher) Start(begin, end uint64, results chan uint64) (*MatcherSession
}
// Iterate over all the blocks in the section and return the matching ones
for
i
:=
first
;
i
<=
last
;
i
++
{
// If the bitset is nil, we're a special match-all cornercase
if
res
.
bitset
==
nil
{
select
{
case
<-
session
.
quit
:
return
case
results
<-
i
:
}
continue
}
// Skip the entire byte if no matches are found inside
next
:=
res
.
bitset
[(
i
-
sectionStart
)
/
8
]
if
next
==
0
{
...
...
@@ -221,7 +213,7 @@ func (m *Matcher) run(begin, end uint64, buffer int, session *MatcherSession) ch
select
{
case
<-
session
.
quit
:
return
case
source
<-
&
partialMatches
{
i
,
nil
}
:
case
source
<-
&
partialMatches
{
i
,
bytes
.
Repeat
([]
byte
{
0xff
},
int
(
m
.
sectionSize
/
8
))
}
:
}
}
}()
...
...
core/bloombits/matcher_test.go
View file @
564c8f3a
...
...
@@ -51,6 +51,11 @@ func TestMatcherRandom(t *testing.T) {
}
}
// Tests that matching on everything doesn't crash (special case internally).
func
TestWildcardMatcher
(
t
*
testing
.
T
)
{
testMatcherBothModes
(
t
,
nil
,
10000
,
0
)
}
// makeRandomIndexes generates a random filter system, composed on multiple filter
// criteria, each having one bloom list component for the address and arbitrarilly
// many topic bloom list components.
...
...
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