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
1025d097
Commit
1025d097
authored
Nov 04, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed old bloom
parent
d56d0c64
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
67 deletions
+0
-67
bloom.go
chain/bloom.go
+0
-47
bloom_test.go
chain/bloom_test.go
+0
-20
No files found.
chain/bloom.go
deleted
100644 → 0
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
}
chain/bloom_test.go
deleted
100644 → 0
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"
)
}
}
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