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
f6206efe
Commit
f6206efe
authored
Jul 24, 2018
by
Wenbiao Zheng
Committed by
Felix Lange
Jul 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consensus: move test use only var/func to test(#17004)
parent
ae674a36
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
clique.go
consensus/clique/clique.go
+0
-1
snapshot_test.go
consensus/clique/snapshot_test.go
+1
-1
algorithm.go
consensus/ethash/algorithm.go
+0
-9
algorithm_test.go
consensus/ethash/algorithm_test.go
+10
-0
No files found.
consensus/clique/clique.go
View file @
f6206efe
...
...
@@ -53,7 +53,6 @@ const (
// Clique proof-of-authority protocol constants.
var
(
epochLength
=
uint64
(
30000
)
// Default number of blocks after which to checkpoint and reset the pending votes
blockPeriod
=
uint64
(
15
)
// Default minimum difference between two consecutive block's timestamps
extraVanity
=
32
// Fixed number of extra-data prefix bytes reserved for signer vanity
extraSeal
=
65
// Fixed number of extra-data suffix bytes reserved for signer seal
...
...
consensus/clique/snapshot_test.go
View file @
f6206efe
...
...
@@ -360,7 +360,7 @@ func TestVoting(t *testing.T) {
for
j
,
vote
:=
range
tt
.
votes
{
headers
[
j
]
=
&
types
.
Header
{
Number
:
big
.
NewInt
(
int64
(
j
)
+
1
),
Time
:
big
.
NewInt
(
int64
(
j
)
*
int64
(
blockPeriod
)
),
Time
:
big
.
NewInt
(
int64
(
j
)
*
15
),
Coinbase
:
accounts
.
address
(
vote
.
voted
),
Extra
:
make
([]
byte
,
extraVanity
+
extraSeal
),
}
...
...
consensus/ethash/algorithm.go
View file @
f6206efe
...
...
@@ -214,15 +214,6 @@ func swap(buffer []byte) {
}
}
// prepare converts an ethash cache or dataset from a byte stream into the internal
// int representation. All ethash methods work with ints to avoid constant byte to
// int conversions as well as to handle both little and big endian systems.
func
prepare
(
dest
[]
uint32
,
src
[]
byte
)
{
for
i
:=
0
;
i
<
len
(
dest
);
i
++
{
dest
[
i
]
=
binary
.
LittleEndian
.
Uint32
(
src
[
i
*
4
:
])
}
}
// fnv is an algorithm inspired by the FNV hash, which in some cases is used as
// a non-associative substitute for XOR. Note that we multiply the prime with
// the full 32-bit input, in contrast with the FNV-1 spec which multiplies the
...
...
consensus/ethash/algorithm_test.go
View file @
f6206efe
...
...
@@ -18,6 +18,7 @@ package ethash
import
(
"bytes"
"encoding/binary"
"io/ioutil"
"math/big"
"os"
...
...
@@ -30,6 +31,15 @@ import (
"github.com/ethereum/go-ethereum/core/types"
)
// prepare converts an ethash cache or dataset from a byte stream into the internal
// int representation. All ethash methods work with ints to avoid constant byte to
// int conversions as well as to handle both little and big endian systems.
func
prepare
(
dest
[]
uint32
,
src
[]
byte
)
{
for
i
:=
0
;
i
<
len
(
dest
);
i
++
{
dest
[
i
]
=
binary
.
LittleEndian
.
Uint32
(
src
[
i
*
4
:
])
}
}
// Tests whether the dataset size calculator works correctly by cross checking the
// hard coded lookup table with the value generated by it.
func
TestSizeCalculations
(
t
*
testing
.
T
)
{
...
...
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