mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 18:00:46 +00:00
Merge pull request #892 from gzliudan/clean_genesis_hash
core, light, params: remove genesis hash of ethereum network
This commit is contained in:
commit
2f06e10b4c
4 changed files with 9 additions and 32 deletions
|
|
@ -162,7 +162,7 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
|
||||||
case g != nil:
|
case g != nil:
|
||||||
log.Info("[configOrDefault] load orignal config", "hash", ghash)
|
log.Info("[configOrDefault] load orignal config", "hash", ghash)
|
||||||
return g.Config
|
return g.Config
|
||||||
case ghash == params.XDCMainnetGenesisHash:
|
case ghash == params.MainnetGenesisHash:
|
||||||
log.Info("[configOrDefault] load mainnetconfig")
|
log.Info("[configOrDefault] load mainnetconfig")
|
||||||
return params.XDCMainnetChainConfig
|
return params.XDCMainnetChainConfig
|
||||||
case ghash == params.TestnetGenesisHash:
|
case ghash == params.TestnetGenesisHash:
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ import (
|
||||||
|
|
||||||
func TestDefaultGenesisBlock(t *testing.T) {
|
func TestDefaultGenesisBlock(t *testing.T) {
|
||||||
block := DefaultGenesisBlock().ToBlock(nil)
|
block := DefaultGenesisBlock().ToBlock(nil)
|
||||||
if block.Hash() != params.XDCMainnetGenesisHash {
|
if block.Hash() != params.MainnetGenesisHash {
|
||||||
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash().String(), params.XDCMainnetGenesisHash.String())
|
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash().String(), params.MainnetGenesisHash.String())
|
||||||
}
|
}
|
||||||
block = DefaultTestnetGenesisBlock().ToBlock(nil)
|
block = DefaultTestnetGenesisBlock().ToBlock(nil)
|
||||||
if block.Hash() != params.TestnetGenesisHash {
|
if block.Hash() != params.TestnetGenesisHash {
|
||||||
|
|
@ -74,7 +74,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
},
|
},
|
||||||
wantHash: params.XDCMainnetGenesisHash,
|
wantHash: params.MainnetGenesisHash,
|
||||||
wantConfig: params.XDCMainnetChainConfig,
|
wantConfig: params.XDCMainnetChainConfig,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -83,7 +83,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
DefaultGenesisBlock().MustCommit(db)
|
DefaultGenesisBlock().MustCommit(db)
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
},
|
},
|
||||||
wantHash: params.XDCMainnetGenesisHash,
|
wantHash: params.MainnetGenesisHash,
|
||||||
wantConfig: params.XDCMainnetChainConfig,
|
wantConfig: params.XDCMainnetChainConfig,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/core/types"
|
"github.com/XinFinOrg/XDPoSChain/core/types"
|
||||||
"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/rlp"
|
"github.com/XinFinOrg/XDPoSChain/rlp"
|
||||||
"github.com/XinFinOrg/XDPoSChain/trie"
|
"github.com/XinFinOrg/XDPoSChain/trie"
|
||||||
)
|
)
|
||||||
|
|
@ -56,29 +55,8 @@ type trustedCheckpoint struct {
|
||||||
sectionHead, chtRoot, bloomTrieRoot common.Hash
|
sectionHead, chtRoot, bloomTrieRoot common.Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
mainnetCheckpoint = trustedCheckpoint{
|
|
||||||
name: "mainnet",
|
|
||||||
sectionIdx: 161,
|
|
||||||
sectionHead: common.HexToHash("75b0c4baa7a62cece48abdcb03b6f31601961c9bece67dcd61df87aad4fc0d8d"),
|
|
||||||
chtRoot: common.HexToHash("bbbfaa67b29716348997ec21a39c03b8d1fb973f6a43740b865595ba26ee812f"),
|
|
||||||
bloomTrieRoot: common.HexToHash("d6db6e6248354d7453391ce97830072a28ea4216be0bd95a5db9f53b1a64677b"),
|
|
||||||
}
|
|
||||||
|
|
||||||
ropstenCheckpoint = trustedCheckpoint{
|
|
||||||
name: "ropsten",
|
|
||||||
sectionIdx: 87,
|
|
||||||
sectionHead: common.HexToHash("ebc0adcb30ed21cbe95bd77499cc1af0bada621fee3644cb80dbcf1444c123fe"),
|
|
||||||
chtRoot: common.HexToHash("d9830f4893c821ddf149b8cb9d3e3bfe3109d2eea8e3c4a4ede7c8b2ee8a7800"),
|
|
||||||
bloomTrieRoot: common.HexToHash("c76e12d713f65b84c5a36d06bc77d0c8419248ea0b36e0812a78b76aa6da0ddb"),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// trustedCheckpoints associates each known checkpoint with the genesis hash of the chain it belongs to
|
// trustedCheckpoints associates each known checkpoint with the genesis hash of the chain it belongs to
|
||||||
var trustedCheckpoints = map[common.Hash]trustedCheckpoint{
|
var trustedCheckpoints = map[common.Hash]trustedCheckpoint{}
|
||||||
params.MainnetGenesisHash: mainnetCheckpoint,
|
|
||||||
params.TestnetGenesisHash: ropstenCheckpoint,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrNoTrustedCht = errors.New("no trusted canonical hash trie")
|
ErrNoTrustedCht = errors.New("no trusted canonical hash trie")
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
XDCMainnetGenesisHash = common.HexToHash("4a9d748bd78a8d0385b67788c2435dcdb914f98a96250b68863a1f8b7642d6b1") // XDC Mainnet genesis hash to enforce below configs on
|
MainnetGenesisHash = common.HexToHash("0x4a9d748bd78a8d0385b67788c2435dcdb914f98a96250b68863a1f8b7642d6b1") // XDC Mainnet genesis hash to enforce below configs on
|
||||||
MainnetGenesisHash = common.HexToHash("8d13370621558f4ed0da587934473c0404729f28b0ff1d50e5fdd840457a2f17") // Mainnet genesis hash to enforce below configs on
|
TestnetGenesisHash = common.HexToHash("0xbdea512b4f12ff1135ec92c00dc047ffb93890c2ea1aa0eefe9b013d80640075") // XDC Testnet genesis hash to enforce below configs on
|
||||||
TestnetGenesisHash = common.HexToHash("bdea512b4f12ff1135ec92c00dc047ffb93890c2ea1aa0eefe9b013d80640075") // Testnet genesis hash to enforce below configs on
|
DevnetGenesisHash = common.HexToHash("0x977c7a1b4ecbc40acc3963c1778666b62a95940a7fba6fec5867f78702835daf") // XDC Devnet genesis hash to enforce below configs on
|
||||||
DevnetGenesisHash = common.HexToHash("ab6fd3cb7d1a489e03250c7d14c2d6d819a6a528d6380b31e8410951964ef423") // Devnet genesis hash to enforce below configs on
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue