core: explicitly rename testnet to ropsten

This commit is contained in:
q9f 2020-04-01 17:01:49 +02:00
parent 287608ffee
commit 112edf11ee
No known key found for this signature in database
GPG key ID: E79CDFA171DC2DF9
4 changed files with 21 additions and 17 deletions

View file

@ -65,8 +65,8 @@ func TestCreation(t *testing.T) {
}, },
// Ropsten test cases // Ropsten test cases
{ {
params.TestnetChainConfig, params.RopstenChainConfig,
params.TestnetGenesisHash, params.RopstenGenesisHash,
[]testcase{ []testcase{
{0, ID{Hash: checksumToBytes(0x30c7ddbc), Next: 10}}, // Unsynced, last Frontier, Homestead and first Tangerine block {0, ID{Hash: checksumToBytes(0x30c7ddbc), Next: 10}}, // Unsynced, last Frontier, Homestead and first Tangerine block
{9, ID{Hash: checksumToBytes(0x30c7ddbc), Next: 10}}, // Last Tangerine block {9, ID{Hash: checksumToBytes(0x30c7ddbc), Next: 10}}, // Last Tangerine block

View file

@ -246,8 +246,12 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
return g.Config return g.Config
case ghash == params.MainnetGenesisHash: case ghash == params.MainnetGenesisHash:
return params.MainnetChainConfig return params.MainnetChainConfig
case ghash == params.TestnetGenesisHash: case ghash == params.RopstenGenesisHash:
return params.TestnetChainConfig return params.RopstenChainConfig
case ghash == params.RinkebyGenesisHash:
return params.RinkebyChainConfig
case ghash == params.GoerliGenesisHash:
return params.GoerliChainConfig
default: default:
return params.AllEthashProtocolChanges return params.AllEthashProtocolChanges
} }
@ -347,15 +351,15 @@ func DefaultGenesisBlock() *Genesis {
} }
} }
// DefaultTestnetGenesisBlock returns the Ropsten network genesis block. // DefaultRopstenGenesisBlock returns the Ropsten network genesis block.
func DefaultTestnetGenesisBlock() *Genesis { func DefaultRopstenGenesisBlock() *Genesis {
return &Genesis{ return &Genesis{
Config: params.TestnetChainConfig, Config: params.RopstenChainConfig,
Nonce: 66, Nonce: 66,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"), ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 16777216, GasLimit: 16777216,
Difficulty: big.NewInt(1048576), Difficulty: big.NewInt(1048576),
Alloc: decodePrealloc(testnetAllocData), Alloc: decodePrealloc(ropstenAllocData),
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -35,9 +35,9 @@ func TestDefaultGenesisBlock(t *testing.T) {
if block.Hash() != params.MainnetGenesisHash { if block.Hash() != params.MainnetGenesisHash {
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash) t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash)
} }
block = DefaultTestnetGenesisBlock().ToBlock(nil) block = DefaultRopstenGenesisBlock().ToBlock(nil)
if block.Hash() != params.TestnetGenesisHash { if block.Hash() != params.RopstenGenesisHash {
t.Errorf("wrong testnet genesis hash, got %v, want %v", block.Hash(), params.TestnetGenesisHash) t.Errorf("wrong ropsten genesis hash, got %v, want %v", block.Hash(), params.RopstenGenesisHash)
} }
} }
@ -95,14 +95,14 @@ func TestSetupGenesis(t *testing.T) {
wantConfig: customg.Config, wantConfig: customg.Config,
}, },
{ {
name: "custom block in DB, genesis == testnet", name: "custom block in DB, genesis == ropsten",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) { fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
customg.MustCommit(db) customg.MustCommit(db)
return SetupGenesisBlock(db, DefaultTestnetGenesisBlock()) return SetupGenesisBlock(db, DefaultRopstenGenesisBlock())
}, },
wantErr: &GenesisMismatchError{Stored: customghash, New: params.TestnetGenesisHash}, wantErr: &GenesisMismatchError{Stored: customghash, New: params.RopstenGenesisHash},
wantHash: params.TestnetGenesisHash, wantHash: params.RopstenGenesisHash,
wantConfig: params.TestnetChainConfig, wantConfig: params.RopstenChainConfig,
}, },
{ {
name: "compatible config in DB", name: "compatible config in DB",