Skip to content

Commit f6206ef

Browse files
jsvisafjl
authored andcommitted
consensus: move test use only var/func to test(#17004)
1 parent ae674a3 commit f6206ef

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎consensus/clique/clique.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const (
5353
// Clique proof-of-authority protocol constants.
5454
var (
5555
epochLength = uint64(30000) // Default number of blocks after which to checkpoint and reset the pending votes
56-
blockPeriod = uint64(15) // Default minimum difference between two consecutive block's timestamps
5756

5857
extraVanity = 32 // Fixed number of extra-data prefix bytes reserved for signer vanity
5958
extraSeal = 65 // Fixed number of extra-data suffix bytes reserved for signer seal

‎consensus/clique/snapshot_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ func TestVoting(t *testing.T) {
360360
for j, vote := range tt.votes {
361361
headers[j] = &types.Header{
362362
Number: big.NewInt(int64(j) + 1),
363-
Time: big.NewInt(int64(j) * int64(blockPeriod)),
363+
Time: big.NewInt(int64(j) * 15),
364364
Coinbase: accounts.address(vote.voted),
365365
Extra: make([]byte, extraVanity+extraSeal),
366366
}

‎consensus/ethash/algorithm.go‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,6 @@ func swap(buffer []byte) {
214214
}
215215
}
216216

217-
// prepare converts an ethash cache or dataset from a byte stream into the internal
218-
// int representation. All ethash methods work with ints to avoid constant byte to
219-
// int conversions as well as to handle both little and big endian systems.
220-
func prepare(dest []uint32, src []byte) {
221-
for i := 0; i < len(dest); i++ {
222-
dest[i] = binary.LittleEndian.Uint32(src[i*4:])
223-
}
224-
}
225-
226217
// fnv is an algorithm inspired by the FNV hash, which in some cases is used as
227218
// a non-associative substitute for XOR. Note that we multiply the prime with
228219
// the full 32-bit input, in contrast with the FNV-1 spec which multiplies the

‎consensus/ethash/algorithm_test.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package ethash
1818

1919
import (
2020
"bytes"
21+
"encoding/binary"
2122
"io/ioutil"
2223
"math/big"
2324
"os"
@@ -30,6 +31,15 @@ import (
3031
"github.com/ethereum/go-ethereum/core/types"
3132
)
3233

34+
// prepare converts an ethash cache or dataset from a byte stream into the internal
35+
// int representation. All ethash methods work with ints to avoid constant byte to
36+
// int conversions as well as to handle both little and big endian systems.
37+
func prepare(dest []uint32, src []byte) {
38+
for i := 0; i < len(dest); i++ {
39+
dest[i] = binary.LittleEndian.Uint32(src[i*4:])
40+
}
41+
}
42+
3343
// Tests whether the dataset size calculator works correctly by cross checking the
3444
// hard coded lookup table with the value generated by it.
3545
func TestSizeCalculations(t *testing.T) {

0 commit comments

Comments
 (0)