diff options
author | Wenbiao Zheng <delweng@gmail.com> | 2018-07-24 08:14:15 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-07-24 08:14:15 +0800 |
commit | f6206efe5bcf28942990e35ef373d273e9785372 (patch) | |
tree | 401fdace59be9cead1f19181b071f70dbec6b0e2 | |
parent | ae674a3660ff7655c9b79bf0c01af0a363efdf4d (diff) | |
download | dexon-f6206efe5bcf28942990e35ef373d273e9785372.tar dexon-f6206efe5bcf28942990e35ef373d273e9785372.tar.gz dexon-f6206efe5bcf28942990e35ef373d273e9785372.tar.bz2 dexon-f6206efe5bcf28942990e35ef373d273e9785372.tar.lz dexon-f6206efe5bcf28942990e35ef373d273e9785372.tar.xz dexon-f6206efe5bcf28942990e35ef373d273e9785372.tar.zst dexon-f6206efe5bcf28942990e35ef373d273e9785372.zip |
consensus: move test use only var/func to test(#17004)
-rw-r--r-- | consensus/clique/clique.go | 1 | ||||
-rw-r--r-- | consensus/clique/snapshot_test.go | 2 | ||||
-rw-r--r-- | consensus/ethash/algorithm.go | 9 | ||||
-rw-r--r-- | consensus/ethash/algorithm_test.go | 10 |
4 files changed, 11 insertions, 11 deletions
diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 01df4d5c7..8968f500f 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -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 diff --git a/consensus/clique/snapshot_test.go b/consensus/clique/snapshot_test.go index 29a837983..5ac730c9e 100644 --- a/consensus/clique/snapshot_test.go +++ b/consensus/clique/snapshot_test.go @@ -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), } diff --git a/consensus/ethash/algorithm.go b/consensus/ethash/algorithm.go index fa1c2c824..f252a7f3a 100644 --- a/consensus/ethash/algorithm.go +++ b/consensus/ethash/algorithm.go @@ -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 diff --git a/consensus/ethash/algorithm_test.go b/consensus/ethash/algorithm_test.go index 841e39233..f0c6465fd 100644 --- a/consensus/ethash/algorithm_test.go +++ b/consensus/ethash/algorithm_test.go @@ -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) { |