good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
maticnetwork
bor
Commits
1025d097
Commit
1025d097
authored
10 years ago
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
removed old bloom
parent
d56d0c64
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
chain/bloom.go
+0
-47
0 additions, 47 deletions
chain/bloom.go
chain/bloom_test.go
+0
-20
0 additions, 20 deletions
chain/bloom_test.go
with
0 additions
and
67 deletions
chain/bloom.go
deleted
100644 → 0
+
0
−
47
View file @
d56d0c64
package
chain
type
BloomFilter
struct
{
bin
[]
byte
}
func
NewBloomFilter
(
bin
[]
byte
)
*
BloomFilter
{
if
bin
==
nil
{
bin
=
make
([]
byte
,
256
)
}
return
&
BloomFilter
{
bin
:
bin
,
}
}
func
(
self
*
BloomFilter
)
Set
(
addr
[]
byte
)
{
if
len
(
addr
)
<
8
{
chainlogger
.
Warnf
(
"err: bloom set to small: %x
\n
"
,
addr
)
return
}
for
_
,
i
:=
range
addr
[
len
(
addr
)
-
8
:
]
{
self
.
bin
[
i
]
=
1
}
}
func
(
self
*
BloomFilter
)
Search
(
addr
[]
byte
)
bool
{
if
len
(
addr
)
<
8
{
chainlogger
.
Warnf
(
"err: bloom search to small: %x
\n
"
,
addr
)
return
false
}
for
_
,
i
:=
range
addr
[
len
(
addr
)
-
8
:
]
{
if
self
.
bin
[
i
]
==
0
{
return
false
}
}
return
true
}
func
(
self
*
BloomFilter
)
Bin
()
[]
byte
{
return
self
.
bin
}
This diff is collapsed.
Click to expand it.
chain/bloom_test.go
deleted
100644 → 0
+
0
−
20
View file @
d56d0c64
package
chain
import
"testing"
func
TestBloomFilter
(
t
*
testing
.
T
)
{
bf
:=
NewBloomFilter
(
nil
)
a
:=
[]
byte
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
0
}
bf
.
Set
(
a
)
b
:=
[]
byte
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
}
if
bf
.
Search
(
a
)
==
false
{
t
.
Error
(
"Expected 'a' to yield true using a bloom filter"
)
}
if
bf
.
Search
(
b
)
{
t
.
Error
(
"Expected 'b' not to field trie using a bloom filter"
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment