mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
consensus: move test use only var/func to testfile
This commit is contained in:
parent
574378edb5
commit
056f5dd9b5
4 changed files with 13 additions and 10 deletions
|
|
@ -53,7 +53,6 @@ const (
|
||||||
// Clique proof-of-authority protocol constants.
|
// Clique proof-of-authority protocol constants.
|
||||||
var (
|
var (
|
||||||
epochLength = uint64(30000) // Default number of blocks after which to checkpoint and reset the pending votes
|
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
|
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
|
extraSeal = 65 // Fixed number of extra-data suffix bytes reserved for signer seal
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ type testerVote struct {
|
||||||
auth bool
|
auth bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blockPeriod is the default minimum difference between two consecutive block's timestamps
|
||||||
|
var blockPeriod = uint64(15)
|
||||||
|
|
||||||
// testerAccountPool is a pool to maintain currently active tester accounts,
|
// testerAccountPool is a pool to maintain currently active tester accounts,
|
||||||
// mapped from textual names used in the tests below to actual Ethereum private
|
// mapped from textual names used in the tests below to actual Ethereum private
|
||||||
// keys capable of signing transactions.
|
// keys capable of signing transactions.
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 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
|
// 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
|
// the full 32-bit input, in contrast with the FNV-1 spec which multiplies the
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package ethash
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -30,6 +31,15 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"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
|
// Tests whether the dataset size calculator works correctly by cross checking the
|
||||||
// hard coded lookup table with the value generated by it.
|
// hard coded lookup table with the value generated by it.
|
||||||
func TestSizeCalculations(t *testing.T) {
|
func TestSizeCalculations(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue