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
cc67a84e
Commit
cc67a84e
authored
Oct 29, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added bloom 9 point lookup and bloom test
parent
81ec564e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
bloom9.go
ethchain/bloom9.go
+12
-1
bloom9_test.go
ethchain/bloom9_test.go
+17
-0
No files found.
ethchain/bloom9.go
View file @
cc67a84e
...
...
@@ -3,6 +3,7 @@ package ethchain
import
(
"math/big"
"github.com/ethereum.backup/ethutil-go"
"github.com/ethereum/go-ethereum/vm"
)
...
...
@@ -23,7 +24,10 @@ func LogsBloom(logs []vm.Log) *big.Int {
for
_
,
topic
:=
range
log
.
Topics
{
data
=
append
(
data
,
topic
)
}
data
=
append
(
data
,
log
.
Data
)
if
log
.
Data
!=
nil
{
data
=
append
(
data
,
log
.
Data
)
}
for
_
,
b
:=
range
data
{
bin
.
Or
(
bin
,
bloom9
(
b
))
...
...
@@ -42,3 +46,10 @@ func bloom9(b []byte) *big.Int {
return
r
}
func
BloomLookup
(
bin
,
topic
[]
byte
)
bool
{
bloom
:=
ethutil
.
BigD
(
bin
)
cmp
:=
bloom9
(
topic
)
return
bloom
.
And
(
bloom
,
cmp
)
.
Cmp
(
cmp
)
==
0
}
ethchain/bloom9_test.go
0 → 100644
View file @
cc67a84e
package
ethchain
import
(
"testing"
"github.com/ethereum/go-ethereum/vm"
)
func
TestBloom9
(
t
*
testing
.
T
)
{
testCase
:=
[]
byte
(
"testtest"
)
bin
:=
LogsBloom
([]
vm
.
Log
{
vm
.
Log
{
testCase
,
nil
,
nil
}})
.
Bytes
()
res
:=
BloomLookup
(
bin
,
testCase
)
if
!
res
{
t
.
Errorf
(
"Bloom lookup failed"
)
}
}
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