Merge pull request #863 from gzliudan/network_flags

all: clean up the network flags
This commit is contained in:
Daniel Liu 2025-02-19 17:24:28 +08:00 committed by GitHub
commit 2f626561f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 79 additions and 97 deletions

View file

@ -45,7 +45,9 @@ var (
utils.DataDirFlag, utils.DataDirFlag,
utils.XDCXDataDirFlag, utils.XDCXDataDirFlag,
utils.LightModeFlag, utils.LightModeFlag,
utils.XDCTestnetFlag, utils.MainnetFlag,
utils.TestnetFlag,
utils.DevnetFlag,
}, },
Description: ` Description: `
The init command initializes a new genesis block and definition for the network. The init command initializes a new genesis block and definition for the network.
@ -154,11 +156,23 @@ Use "ethereum dump 0" to dump the genesis block.`,
// initGenesis will initialise the given JSON format genesis file and writes it as // initGenesis will initialise the given JSON format genesis file and writes it as
// the zero'd block (i.e. genesis) or will fail hard if it can't succeed. // the zero'd block (i.e. genesis) or will fail hard if it can't succeed.
func initGenesis(ctx *cli.Context) error { func initGenesis(ctx *cli.Context) error {
utils.CheckExclusive(ctx, utils.MainnetFlag, utils.TestnetFlag, utils.DevnetFlag)
var err error var err error
genesis := new(core.Genesis) genesis := new(core.Genesis)
if ctx.Bool(utils.XDCTestnetFlag.Name) { if ctx.Bool(utils.MainnetFlag.Name) {
if ctx.Args().Len() > 0 { if ctx.Args().Len() > 0 {
utils.Fatalf("Flags --apothem and genesis file can't be used at the same time") utils.Fatalf("The mainnet flag and genesis file can't be used at the same time")
}
err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis)
} else if ctx.Bool(utils.TestnetFlag.Name) {
if ctx.Args().Len() > 0 {
utils.Fatalf("The testnet flag and genesis file can't be used at the same time")
}
err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis)
} else if ctx.Bool(utils.DevnetFlag.Name) {
if ctx.Args().Len() > 0 {
utils.Fatalf("The devnet flag and genesis file can't be used at the same time")
} }
err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis) err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis)
} else { } else {
@ -166,9 +180,9 @@ func initGenesis(ctx *cli.Context) error {
utils.Fatalf("need the genesis.json file or the network name [ mainnet | testnet | devnet ] as the only argument") utils.Fatalf("need the genesis.json file or the network name [ mainnet | testnet | devnet ] as the only argument")
} }
genesisPath := ctx.Args().First() genesisPath := ctx.Args().First()
if genesisPath == "mainnet" { if genesisPath == "mainnet" || genesisPath == "xinfin" {
err = json.Unmarshal(xdc_genesis.MainnetGenesis, &genesis) err = json.Unmarshal(xdc_genesis.MainnetGenesis, &genesis)
} else if genesisPath == "testnet" { } else if genesisPath == "testnet" || genesisPath == "apothem" {
err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis) err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis)
} else if genesisPath == "devnet" { } else if genesisPath == "devnet" {
err = json.Unmarshal(xdc_genesis.DevnetGenesis, &genesis) err = json.Unmarshal(xdc_genesis.DevnetGenesis, &genesis)

View file

@ -157,7 +157,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
} }
// Check testnet is enable. // Check testnet is enable.
if ctx.Bool(utils.XDCTestnetFlag.Name) { if ctx.Bool(utils.TestnetFlag.Name) {
common.IsTestnet = true common.IsTestnet = true
common.TRC21IssuerSMC = common.TRC21IssuerSMCTestNet common.TRC21IssuerSMC = common.TRC21IssuerSMCTestNet
cfg.Eth.NetworkId = 51 cfg.Eth.NetworkId = 51

View file

@ -125,8 +125,8 @@ func remoteConsole(ctx *cli.Context) error {
if path != "" { if path != "" {
if ctx.Bool(utils.TestnetFlag.Name) { if ctx.Bool(utils.TestnetFlag.Name) {
path = filepath.Join(path, "testnet") path = filepath.Join(path, "testnet")
} else if ctx.Bool(utils.RinkebyFlag.Name) { } else if ctx.Bool(utils.DevnetFlag.Name) {
path = filepath.Join(path, "rinkeby") path = filepath.Join(path, "devnet")
} }
} }
endpoint = fmt.Sprintf("%s/XDC.ipc", path) endpoint = fmt.Sprintf("%s/XDC.ipc", path)

View file

@ -117,10 +117,10 @@ var (
utils.NodeKeyHexFlag, utils.NodeKeyHexFlag,
//utils.DeveloperFlag, //utils.DeveloperFlag,
//utils.DeveloperPeriodFlag, //utils.DeveloperPeriodFlag,
//utils.TestnetFlag, utils.MainnetFlag,
//utils.RinkebyFlag, utils.TestnetFlag,
utils.DevnetFlag,
//utils.VMEnableDebugFlag, //utils.VMEnableDebugFlag,
utils.XDCTestnetFlag,
utils.Enable0xPrefixFlag, utils.Enable0xPrefixFlag,
utils.EnableXDCPrefixFlag, utils.EnableXDCPrefixFlag,
utils.RewoundFlag, utils.RewoundFlag,

View file

@ -104,19 +104,21 @@ var (
Value: ethconfig.Defaults.NetworkId, Value: ethconfig.Defaults.NetworkId,
Category: flags.EthCategory, Category: flags.EthCategory,
} }
MainnetFlag = &cli.BoolFlag{
Name: "mainnet",
Aliases: []string{"xinfin"},
Usage: "XDC xinfin network",
Category: flags.EthCategory,
}
TestnetFlag = &cli.BoolFlag{ TestnetFlag = &cli.BoolFlag{
Name: "testnet", Name: "testnet",
Usage: "Ropsten network: pre-configured proof-of-work test network", Aliases: []string{"apothem"},
Usage: "XDC apothem network",
Category: flags.EthCategory, Category: flags.EthCategory,
} }
XDCTestnetFlag = &cli.BoolFlag{ DevnetFlag = &cli.BoolFlag{
Name: "apothem", Name: "devnet",
Usage: "XDC Apothem Network", Usage: "XDC develop network",
Category: flags.EthCategory,
}
RinkebyFlag = &cli.BoolFlag{
Name: "rinkeby",
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
Category: flags.EthCategory, Category: flags.EthCategory,
} }
@ -823,8 +825,8 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.Bool(TestnetFlag.Name) { if ctx.Bool(TestnetFlag.Name) {
return filepath.Join(path, "testnet") return filepath.Join(path, "testnet")
} }
if ctx.Bool(RinkebyFlag.Name) { if ctx.Bool(DevnetFlag.Name) {
return filepath.Join(path, "rinkeby") return filepath.Join(path, "devnet")
} }
return path return path
} }
@ -883,14 +885,11 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
if cfg.BootstrapNodes != nil { if cfg.BootstrapNodes != nil {
return // Already set by config file, don't apply defaults. return // Already set by config file, don't apply defaults.
} }
networkID := uint64(0) networkID := ctx.Uint64(NetworkIdFlag.Name)
if ctx.IsSet(NetworkIdFlag.Name) {
networkID = ctx.Uint64(NetworkIdFlag.Name)
}
switch { switch {
case ctx.Bool(XDCTestnetFlag.Name) || networkID == params.TestnetChainConfig.ChainId.Uint64(): case ctx.Bool(TestnetFlag.Name) || networkID == 51:
urls = params.TestnetBootnodes urls = params.TestnetBootnodes
case networkID == params.DevnetChainConfig.ChainId.Uint64(): case ctx.Bool(DevnetFlag.Name) || networkID == 551:
urls = params.DevnetBootnodes urls = params.DevnetBootnodes
} }
} }
@ -921,8 +920,10 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
urls = SplitAndTrim(ctx.String(BootnodesFlag.Name)) urls = SplitAndTrim(ctx.String(BootnodesFlag.Name))
case ctx.IsSet(BootnodesV5Flag.Name): case ctx.IsSet(BootnodesV5Flag.Name):
urls = SplitAndTrim(ctx.String(BootnodesV5Flag.Name)) urls = SplitAndTrim(ctx.String(BootnodesV5Flag.Name))
case ctx.Bool(XDCTestnetFlag.Name): case ctx.Bool(TestnetFlag.Name):
urls = params.TestnetBootnodes urls = params.TestnetBootnodes
case ctx.Bool(DevnetFlag.Name):
urls = params.DevnetBootnodes
case cfg.BootstrapNodesV5 != nil: case cfg.BootstrapNodesV5 != nil:
return // already set, don't apply defaults. return // already set, don't apply defaults.
} }
@ -1200,8 +1201,8 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = "" // unless explicitly requested, use memory databases cfg.DataDir = "" // unless explicitly requested, use memory databases
case ctx.Bool(TestnetFlag.Name): case ctx.Bool(TestnetFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet") cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
case ctx.Bool(RinkebyFlag.Name): case ctx.Bool(DevnetFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby") cfg.DataDir = filepath.Join(node.DefaultDataDir(), "devnet")
} }
if ctx.IsSet(KeyStoreDirFlag.Name) { if ctx.IsSet(KeyStoreDirFlag.Name) {
@ -1393,7 +1394,7 @@ func SetXDCXConfig(ctx *cli.Context, cfg *XDCx.Config, XDCDataDir string) {
// SetEthConfig applies eth-related command line flags to the config. // SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Avoid conflicting network flags // Avoid conflicting network flags
CheckExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag) CheckExclusive(ctx, MainnetFlag, TestnetFlag, DevnetFlag, DeveloperFlag)
CheckExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag) CheckExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
CheckExclusive(ctx, LightServFlag, LightModeFlag) CheckExclusive(ctx, LightServFlag, LightModeFlag)
CheckExclusive(ctx, LightServFlag, SyncModeFlag, "light") CheckExclusive(ctx, LightServFlag, SyncModeFlag, "light")
@ -1443,9 +1444,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.IsSet(NetworkIdFlag.Name) { if ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name) cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name)
} }
if ctx.Bool(XDCTestnetFlag.Name) {
cfg.NetworkId = 51
}
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) { if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) {
cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100 cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100
@ -1499,16 +1497,21 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
} }
// Override any default configs for hard coded networks. // Override any default configs for hard coded networks.
switch { switch {
case ctx.Bool(MainnetFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 50
}
cfg.Genesis = core.DefaultGenesisBlock()
case ctx.Bool(TestnetFlag.Name): case ctx.Bool(TestnetFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) { if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 3 cfg.NetworkId = 51
} }
cfg.Genesis = core.DefaultTestnetGenesisBlock() cfg.Genesis = core.DefaultTestnetGenesisBlock()
case ctx.Bool(RinkebyFlag.Name): case ctx.Bool(DevnetFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) { if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 4 cfg.NetworkId = 551
} }
cfg.Genesis = core.DefaultRinkebyGenesisBlock() cfg.Genesis = core.DefaultDevnetGenesisBlock()
case ctx.Bool(DeveloperFlag.Name): case ctx.Bool(DeveloperFlag.Name):
// Create new developer account or reuse existing one // Create new developer account or reuse existing one
var ( var (
@ -1628,10 +1631,12 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.
func MakeGenesis(ctx *cli.Context) *core.Genesis { func MakeGenesis(ctx *cli.Context) *core.Genesis {
var genesis *core.Genesis var genesis *core.Genesis
switch { switch {
case ctx.Bool(MainnetFlag.Name):
genesis = core.DefaultGenesisBlock()
case ctx.Bool(TestnetFlag.Name): case ctx.Bool(TestnetFlag.Name):
genesis = core.DefaultTestnetGenesisBlock() genesis = core.DefaultTestnetGenesisBlock()
case ctx.Bool(RinkebyFlag.Name): case ctx.Bool(DevnetFlag.Name):
genesis = core.DefaultRinkebyGenesisBlock() genesis = core.DefaultDevnetGenesisBlock()
case ctx.Bool(DeveloperFlag.Name): case ctx.Bool(DeveloperFlag.Name):
Fatalf("Developer chains are ephemeral") Fatalf("Developer chains are ephemeral")
} }

View file

@ -28,7 +28,7 @@ var localConstant = constant{
TIPV2SwitchBlock: big.NewInt(0), TIPV2SwitchBlock: big.NewInt(0),
tipXDCXMinerDisable: big.NewInt(0), tipXDCXMinerDisable: big.NewInt(0),
tipXDCXReceiverDisable: big.NewInt(0), tipXDCXReceiverDisable: big.NewInt(0),
eip1559Block: big.NewInt(9999999999), eip1559Block: big.NewInt(0),
cancunBlock: big.NewInt(9999999999), cancunBlock: big.NewInt(9999999999),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"), trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"),

View file

@ -21,7 +21,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"math/big" "math/big"
"strings"
"github.com/XinFinOrg/XDPoSChain/common" "github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/common/hexutil" "github.com/XinFinOrg/XDPoSChain/common/hexutil"
@ -33,7 +32,6 @@ import (
"github.com/XinFinOrg/XDPoSChain/ethdb" "github.com/XinFinOrg/XDPoSChain/ethdb"
"github.com/XinFinOrg/XDPoSChain/log" "github.com/XinFinOrg/XDPoSChain/log"
"github.com/XinFinOrg/XDPoSChain/params" "github.com/XinFinOrg/XDPoSChain/params"
"github.com/XinFinOrg/XDPoSChain/rlp"
) )
//go:generate go run github.com/fjl/gencodec -type Genesis -field-override genesisSpecMarshaling -out gen_genesis.go //go:generate go run github.com/fjl/gencodec -type Genesis -field-override genesisSpecMarshaling -out gen_genesis.go
@ -267,11 +265,10 @@ func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big
return g.MustCommit(db) return g.MustCommit(db)
} }
// DefaultGenesisBlock returns the Ethereum main net genesis block. // DefaultGenesisBlock returns the XDC mainnet genesis block.
func DefaultGenesisBlock() *Genesis { func DefaultGenesisBlock() *Genesis {
config := params.XDCMainnetChainConfig
return &Genesis{ return &Genesis{
Config: config, Config: params.XDCMainnetChainConfig,
Nonce: 0, Nonce: 0,
ExtraData: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000025c65b4b379ac37cf78357c4915f73677022eaffc7d49d0a2cf198deebd6ce581af465944ec8b2bbcfccdea1006a5cfa7d9484b5b293b46964c265c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), ExtraData: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000025c65b4b379ac37cf78357c4915f73677022eaffc7d49d0a2cf198deebd6ce581af465944ec8b2bbcfccdea1006a5cfa7d9484b5b293b46964c265c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
GasLimit: 4700000, GasLimit: 4700000,
@ -281,10 +278,8 @@ func DefaultGenesisBlock() *Genesis {
} }
} }
// DefaultTestnetGenesisBlock returns the Ropsten network genesis block. // DefaultTestnetGenesisBlock returns the XDC testnet genesis block.
func DefaultTestnetGenesisBlock() *Genesis { func DefaultTestnetGenesisBlock() *Genesis {
config := params.TestnetChainConfig
config.XDPoS.V2 = nil
return &Genesis{ return &Genesis{
Config: params.TestnetChainConfig, Config: params.TestnetChainConfig,
Nonce: 0, Nonce: 0,
@ -296,15 +291,16 @@ func DefaultTestnetGenesisBlock() *Genesis {
} }
} }
// DefaultRinkebyGenesisBlock returns the Rinkeby network genesis block. // DefaultDevnetGenesisBlock returns the XDC devnet genesis block.
func DefaultRinkebyGenesisBlock() *Genesis { func DefaultDevnetGenesisBlock() *Genesis {
return &Genesis{ return &Genesis{
Config: params.RinkebyChainConfig, Config: params.DevnetChainConfig,
Timestamp: 1492009146, Nonce: 0,
ExtraData: hexutil.MustDecode("0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000311bdf9066246e68559816e7f636435867f824ef442a44a6fc20f5b8dfa8b304d7137581f7e6bef347318441696e9ae962633c16e04d53935272639d537fc89618edae86950e12687a612e15c4786b8473898cc3c5beca5841306b26fdb4e30411392a6a74826141342a4dc33a1045cefa4182b6212ec0317bc30fbeb7208192d1474b5f87ffbc056de43c11888c073313b36cf03cf1f739f39443551ff12bbe8d993351c0e2db739f9bcbfdeda94d73b50b16d3a242960b7ca1937e826bda6c397df74d9f9ab01aa89af636787499e81362e815e36f28763eac120babebf5a6cbe6113780cbe489e3eb0db882381aebaf81190100d82f41ad2c95898195c7a47dc59115bb5ec85408683795da2f604a5c0464868eabfcb6da489a1b4304f49aafaec938c7adc48539470624e1f9c75ce33e568d8fa3ace90497ee0c60dc921eefea93e384a6ccaaf28e33790a2d1b2625bf964dfc087e2622b02b0bb78713e872c02796ef64c8f10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
GasLimit: 4700000, GasLimit: 4700000,
Difficulty: big.NewInt(1), Difficulty: big.NewInt(1),
Alloc: decodePrealloc(""), Alloc: DecodeAllocJson(DevnetAllocData),
Timestamp: 1735513074,
} }
} }
@ -336,18 +332,6 @@ func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis {
} }
} }
func decodePrealloc(data string) types.GenesisAlloc {
var p []struct{ Addr, Balance *big.Int }
if err := rlp.NewStream(strings.NewReader(data), 0).Decode(&p); err != nil {
panic(err)
}
ga := make(types.GenesisAlloc, len(p))
for _, account := range p {
ga[common.BigToAddress(account.Addr)] = types.Account{Balance: account.Balance}
}
return ga
}
func DecodeAllocJson(s string) types.GenesisAlloc { func DecodeAllocJson(s string) types.GenesisAlloc {
alloc := types.GenesisAlloc{} alloc := types.GenesisAlloc{}
json.Unmarshal([]byte(s), &alloc) json.Unmarshal([]byte(s), &alloc)

View file

@ -1080,7 +1080,7 @@ func (pm *ProtocolManager) lendingTxBroadcastLoop() {
// NodeInfo represents a short summary of the Ethereum sub-protocol metadata // NodeInfo represents a short summary of the Ethereum sub-protocol metadata
// known about the host peer. // known about the host peer.
type NodeInfo struct { type NodeInfo struct {
Network uint64 `json:"network"` // Ethereum network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4) Network uint64 `json:"network"` // XDC network ID (50=xinfin, 51=apothem, 551=devnet)
Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain
Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block
Config *params.ChainConfig `json:"config"` // Chain configuration for the fork rules Config *params.ChainConfig `json:"config"` // Chain configuration for the fork rules

View file

@ -92,6 +92,12 @@ func New(ctx *node.ServiceContext, config *ethconfig.Config) (*LightEthereum, er
return nil, genesisErr return nil, genesisErr
} }
networkID := config.NetworkId
if networkID == 0 {
networkID = chainConfig.ChainId.Uint64()
}
common.CopyConstans(networkID)
log.Info(strings.Repeat("-", 153)) log.Info(strings.Repeat("-", 153))
for _, line := range strings.Split(chainConfig.Description(), "\n") { for _, line := range strings.Split(chainConfig.Description(), "\n") {
log.Info(line) log.Info(line)
@ -101,10 +107,6 @@ func New(ctx *node.ServiceContext, config *ethconfig.Config) (*LightEthereum, er
peers := newPeerSet() peers := newPeerSet()
quitSync := make(chan struct{}) quitSync := make(chan struct{})
networkID := config.NetworkId
if networkID == 0 {
networkID = chainConfig.ChainId.Uint64()
}
leth := &LightEthereum{ leth := &LightEthereum{
config: config, config: config,
chainConfig: chainConfig, chainConfig: chainConfig,

View file

@ -1184,7 +1184,7 @@ func (pm *ProtocolManager) txStatus(hashes []common.Hash) []txStatus {
// NodeInfo represents a short summary of the Ethereum sub-protocol metadata // NodeInfo represents a short summary of the Ethereum sub-protocol metadata
// known about the host peer. // known about the host peer.
type NodeInfo struct { type NodeInfo struct {
Network uint64 `json:"network"` // Ethereum network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4) Network uint64 `json:"network"` // XDC network ID (50=xinfin, 51=apothem, 551=devnet)
Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain
Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block
Config *params.ChainConfig `json:"config"` // Chain configuration for the fork rules Config *params.ChainConfig `json:"config"` // Chain configuration for the fork rules

View file

@ -240,29 +240,6 @@ var (
}, },
} }
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
RinkebyChainConfig = &ChainConfig{
ChainId: big.NewInt(4),
HomesteadBlock: big.NewInt(1),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(2),
EIP155Block: big.NewInt(3),
EIP158Block: big.NewInt(3),
ByzantiumBlock: big.NewInt(1035301),
ConstantinopleBlock: nil,
XDPoS: &XDPoSConfig{
Period: 15,
Epoch: 900,
V2: &V2{
SwitchEpoch: 9999999999 / 900,
SwitchBlock: big.NewInt(9999999999),
CurrentConfig: MainnetV2Configs[0],
AllConfigs: MainnetV2Configs,
},
},
}
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced // AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus. // and accepted by the Ethereum core developers into the Ethash consensus.
// //