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
6ff2c029
Unverified
Commit
6ff2c029
authored
Sep 05, 2017
by
Zsolt Felfoldi
Committed by
Péter Szilágyi
Sep 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/bloombits: AddBloom index parameter and fixes variable names
parent
f585f9ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
generator.go
core/bloombits/generator.go
+8
-5
generator_test.go
core/bloombits/generator_test.go
+1
-1
bloombits.go
eth/bloombits.go
+1
-1
bench_test.go
eth/filters/bench_test.go
+1
-1
No files found.
core/bloombits/generator.go
View file @
6ff2c029
...
...
@@ -49,21 +49,24 @@ func NewGenerator(sections uint) (*Generator, error) {
// AddBloom takes a single bloom filter and sets the corresponding bit column
// in memory accordingly.
func
(
b
*
Generator
)
AddBloom
(
bloom
types
.
Bloom
)
error
{
func
(
b
*
Generator
)
AddBloom
(
index
uint
,
bloom
types
.
Bloom
)
error
{
// Make sure we're not adding more bloom filters than our capacity
if
b
.
nextBit
>=
b
.
sections
{
return
errSectionOutOfBounds
}
if
b
.
nextBit
!=
index
{
return
errors
.
New
(
"bloom filter with unexpected index"
)
}
// Rotate the bloom and insert into our collection
byte
Mask
:=
b
.
nextBit
/
8
byte
Index
:=
b
.
nextBit
/
8
bitMask
:=
byte
(
1
)
<<
byte
(
7
-
b
.
nextBit
%
8
)
for
i
:=
0
;
i
<
types
.
BloomBitLength
;
i
++
{
bloomByte
Mask
:=
types
.
BloomByteLength
-
1
-
i
/
8
bloomByte
Index
:=
types
.
BloomByteLength
-
1
-
i
/
8
bloomBitMask
:=
byte
(
1
)
<<
byte
(
i
%
8
)
if
(
bloom
[
bloomByte
Mask
]
&
bloomBitMask
)
!=
0
{
b
.
blooms
[
i
][
byte
Mask
]
|=
bitMask
if
(
bloom
[
bloomByte
Index
]
&
bloomBitMask
)
!=
0
{
b
.
blooms
[
i
][
byte
Index
]
|=
bitMask
}
}
b
.
nextBit
++
...
...
core/bloombits/generator_test.go
View file @
6ff2c029
...
...
@@ -44,7 +44,7 @@ func TestGenerator(t *testing.T) {
t
.
Fatalf
(
"failed to create bloombit generator: %v"
,
err
)
}
for
i
,
bloom
:=
range
input
{
if
err
:=
gen
.
AddBloom
(
bloom
);
err
!=
nil
{
if
err
:=
gen
.
AddBloom
(
uint
(
i
),
bloom
);
err
!=
nil
{
t
.
Fatalf
(
"bloom %d: failed to add: %v"
,
i
,
err
)
}
}
...
...
eth/bloombits.go
View file @
6ff2c029
...
...
@@ -122,7 +122,7 @@ func (b *BloomIndexer) Reset(section uint64) {
// Process implements core.ChainIndexerBackend, adding a new header's bloom into
// the index.
func
(
b
*
BloomIndexer
)
Process
(
header
*
types
.
Header
)
{
b
.
gen
.
AddBloom
(
header
.
Bloom
)
b
.
gen
.
AddBloom
(
uint
(
header
.
Number
.
Uint64
()
-
b
.
section
*
b
.
size
),
header
.
Bloom
)
b
.
head
=
header
.
Hash
()
}
...
...
eth/filters/bench_test.go
View file @
6ff2c029
...
...
@@ -98,7 +98,7 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) {
if
header
==
nil
{
b
.
Fatalf
(
"Error creating bloomBits data"
)
}
bc
.
AddBloom
(
header
.
Bloom
)
bc
.
AddBloom
(
uint
(
i
-
sectionIdx
*
sectionSize
),
header
.
Bloom
)
}
sectionHead
:=
core
.
GetCanonicalHash
(
db
,
(
sectionIdx
+
1
)
*
sectionSize
-
1
)
for
i
:=
0
;
i
<
types
.
BloomBitLength
;
i
++
{
...
...
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