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
35fe4313
Commit
35fe4313
authored
Jan 12, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pre-pow
parent
7e6b72cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
2 deletions
+50
-2
chain_manager_test.go
core/chain_manager_test.go
+18
-0
crypto_test.go
crypto/crypto_test.go
+13
-0
old_filter.go
event/filter/old_filter.go
+0
-2
crypto.c
pow/dash/crypto.c
+5
-0
crypto.go
pow/dash/crypto.go
+14
-0
No files found.
core/chain_manager_test.go
View file @
35fe4313
...
...
@@ -128,3 +128,21 @@ func TestChainMultipleInsertions(t *testing.T) {
t
.
Error
(
"Invalid canonical chain"
)
}
}
func
TestGetAncestors
(
t
*
testing
.
T
)
{
db
,
_
:=
ethdb
.
NewMemDatabase
()
var
eventMux
event
.
TypeMux
chainMan
:=
NewChainManager
(
db
,
&
eventMux
)
chain
,
err
:=
loadChain
(
"valid1"
,
t
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
t
.
FailNow
()
}
for
_
,
block
:=
range
chain
{
chainMan
.
write
(
block
)
}
ancestors
:=
chainMan
.
GetAncestors
(
chain
[
len
(
chain
)
-
1
],
4
)
fmt
.
Println
(
ancestors
)
}
crypto/crypto_test.go
View file @
35fe4313
...
...
@@ -3,7 +3,9 @@ package crypto
import
(
"bytes"
"encoding/hex"
"fmt"
"testing"
"time"
)
// These tests are sanity checks.
...
...
@@ -34,3 +36,14 @@ func checkhash(t *testing.T, name string, f func([]byte) []byte, msg, exp []byte
t
.
Errorf
(
"hash %s returned wrong result.
\n
got: %x
\n
want: %x"
,
name
,
sum
,
exp
)
}
}
func
BenchmarkSha3
(
b
*
testing
.
B
)
{
a
:=
[]
byte
(
"hello world"
)
amount
:=
1000000
start
:=
time
.
Now
()
for
i
:=
0
;
i
<
amount
;
i
++
{
Sha3
(
a
)
}
fmt
.
Println
(
amount
,
":"
,
time
.
Since
(
start
))
}
event/filter/old_filter.go
View file @
35fe4313
...
...
@@ -2,7 +2,6 @@
package
filter
import
(
"fmt"
"sync"
"github.com/ethereum/go-ethereum/core"
...
...
@@ -79,7 +78,6 @@ out:
self
.
filterMu
.
RUnlock
()
case
state
.
Messages
:
fmt
.
Println
(
"got messages"
)
self
.
filterMu
.
RLock
()
for
_
,
filter
:=
range
self
.
filters
{
if
filter
.
MessageCallback
!=
nil
{
...
...
pow/dash/crypto.c
0 → 100644
View file @
35fe4313
extern
char
*
Sha3
(
char
*
,
int
);
char
*
sha3_cgo
(
char
*
data
,
int
l
)
{
return
Sha3
(
data
,
l
);
}
pow/dash/crypto.go
0 → 100644
View file @
35fe4313
package
dash
/*
char *sha3_cgo(char *, int); // Forward declaration
*/
import
"C"
import
(
"github.com/ethereum/go-ethereum/crypto"
)
//export Sha3
func
Sha3
(
data
[]
byte
,
l
int
)
[]
byte
{
return
crypto
.
Sha3
(
data
)
}
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