mobile: allow for returning the goerli spec

This commit is contained in:
q9f 2020-04-01 17:03:52 +02:00
parent e0c35d7e97
commit b482bebec3
No known key found for this signature in database
GPG key ID: E79CDFA171DC2DF9
2 changed files with 15 additions and 6 deletions

View file

@ -146,9 +146,9 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
if err := json.Unmarshal([]byte(config.EthereumGenesis), genesis); err != nil {
return nil, fmt.Errorf("invalid genesis spec: %v", err)
}
// If we have the testnet, hard code the chain configs too
if config.EthereumGenesis == TestnetGenesis() {
genesis.Config = params.TestnetChainConfig
// If we have the Ropsten testnet, hard code the chain configs too
if config.EthereumGenesis == RopstenGenesis() {
genesis.Config = params.RopstenChainConfig
if config.EthereumNetworkID == 1 {
config.EthereumNetworkID = 3
}

View file

@ -32,9 +32,9 @@ func MainnetGenesis() string {
return ""
}
// TestnetGenesis returns the JSON spec to use for the Ethereum test network.
func TestnetGenesis() string {
enc, err := json.Marshal(core.DefaultTestnetGenesisBlock())
// RopstenGenesis returns the JSON spec to use for the Ropsten test network.
func RopstenGenesis() string {
enc, err := json.Marshal(core.DefaultRopstenGenesisBlock())
if err != nil {
panic(err)
}
@ -50,6 +50,15 @@ func RinkebyGenesis() string {
return string(enc)
}
// GoerliGenesis returns the JSON spec to use for the Goerli test network
func GoerliGenesis() string {
enc, err := json.Marshal(core.DefaultGoerliGenesisBlock())
if err != nil {
panic(err)
}
return string(enc)
}
// FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated
// by the foundation running the V5 discovery protocol.
func FoundationBootnodes() *Enodes {