Add goerli testnet

This commit is contained in:
Dmitry 2019-03-14 10:43:32 +02:00 committed by Dmitry Shulyak
parent c3b0644bbc
commit eeaf669006
5 changed files with 20 additions and 2 deletions

View File

@ -49,8 +49,8 @@ var (
"network-id", "network-id",
params.RopstenNetworkID, params.RopstenNetworkID,
fmt.Sprintf( fmt.Sprintf(
"A network ID: %d (Mainnet), %d (Ropsten), %d (Rinkeby)", "A network ID: %d (Mainnet), %d (Ropsten), %d (Rinkeby), %d (Goerli)",
params.MainNetworkID, params.RopstenNetworkID, params.RinkebyNetworkID, params.MainNetworkID, params.RopstenNetworkID, params.RinkebyNetworkID, params.GoerliNetworkID,
), ),
) )

View File

@ -174,6 +174,8 @@ func calculateGenesis(networkID uint64) (*core.Genesis, error) {
genesis = core.DefaultTestnetGenesisBlock() genesis = core.DefaultTestnetGenesisBlock()
case params.RinkebyNetworkID: case params.RinkebyNetworkID:
genesis = core.DefaultRinkebyGenesisBlock() genesis = core.DefaultRinkebyGenesisBlock()
case params.GoerliNetworkID:
genesis = core.DefaultGoerliGenesisBlock()
case params.StatusChainNetworkID: case params.StatusChainNetworkID:
var err error var err error
if genesis, err = defaultStatusChainGenesisBlock(); err != nil { if genesis, err = defaultStatusChainGenesisBlock(); err != nil {

View File

@ -726,6 +726,8 @@ func getUpstreamURL(networkID uint64) string {
return RopstenEthereumNetworkURL return RopstenEthereumNetworkURL
case RinkebyNetworkID: case RinkebyNetworkID:
return RinkebyEthereumNetworkURL return RinkebyEthereumNetworkURL
case GoerliNetworkID:
return GoerliEthereumNetworkURL
} }
return "" return ""

View File

@ -39,6 +39,10 @@ const (
// allow us avoid syncing node. // allow us avoid syncing node.
RinkebyEthereumNetworkURL = "https://rinkeby.infura.io/nKmXgiFgc2KqtoQ8BCGJ" RinkebyEthereumNetworkURL = "https://rinkeby.infura.io/nKmXgiFgc2KqtoQ8BCGJ"
// GoerliEthereumNetworkURL is an open RPC endpoint to Goerli network
// Other RPC endpoints are available here: http://goerli.blockscout.com/
GoerliEthereumNetworkURL = "http://goerli.blockscout.com/"
// MainNetworkID is id of the main network // MainNetworkID is id of the main network
MainNetworkID = 1 MainNetworkID = 1
@ -48,6 +52,9 @@ const (
// RinkebyNetworkID is id of a test network (on PoA) // RinkebyNetworkID is id of a test network (on PoA)
RinkebyNetworkID = 4 RinkebyNetworkID = 4
// GoerliNetworkID is id of goerli test network (PoA)
GoerliNetworkID = 5
// StatusChainNetworkID is id of a test network (private chain) // StatusChainNetworkID is id of a test network (private chain)
StatusChainNetworkID = 777 StatusChainNetworkID = 777

View File

@ -52,6 +52,7 @@ var (
params.RopstenNetworkID: "Ropsten", params.RopstenNetworkID: "Ropsten",
params.RinkebyNetworkID: "Rinkeby", params.RinkebyNetworkID: "Rinkeby",
params.StatusChainNetworkID: "StatusChain", params.StatusChainNetworkID: "StatusChain",
params.GoerliNetworkID: "Goerli",
} }
// All general log messages in this package should be routed through this logger. // All general log messages in this package should be routed through this logger.
@ -133,6 +134,8 @@ func GetRemoteURLFromNetworkID(id int) (url string, err error) {
url = params.RinkebyEthereumNetworkURL url = params.RinkebyEthereumNetworkURL
case params.RopstenNetworkID: case params.RopstenNetworkID:
url = params.RopstenEthereumNetworkURL url = params.RopstenEthereumNetworkURL
case params.GoerliNetworkID:
url = params.GoerliEthereumNetworkURL
default: default:
err = ErrNoRemoteURL err = ErrNoRemoteURL
} }
@ -151,6 +154,8 @@ func GetHeadHashFromNetworkID(id int) string {
return "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d" return "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"
case params.StatusChainNetworkID: case params.StatusChainNetworkID:
return "0xe9d8920a99dc66a9557a87d51f9d14a34ec50aae04298e0f142187427d3c832e" return "0xe9d8920a99dc66a9557a87d51f9d14a34ec50aae04298e0f142187427d3c832e"
case params.GoerliNetworkID:
return "0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a"
} }
// Every other ID must break the test. // Every other ID must break the test.
panic(fmt.Sprintf("invalid network id: %d", id)) panic(fmt.Sprintf("invalid network id: %d", id))
@ -178,6 +183,8 @@ func GetNetworkID() int {
return params.RopstenNetworkID return params.RopstenNetworkID
case fmt.Sprintf("%d", params.StatusChainNetworkID), "statuschain": case fmt.Sprintf("%d", params.StatusChainNetworkID), "statuschain":
return params.StatusChainNetworkID return params.StatusChainNetworkID
case fmt.Sprintf("%d", params.GoerliNetworkID), "goerli":
return params.GoerliNetworkID
} }
// Every other selected network must break the test. // Every other selected network must break the test.
panic(fmt.Sprintf("invalid selected network: %q", *networkSelected)) panic(fmt.Sprintf("invalid selected network: %q", *networkSelected))