Merge pull request #3515 from bas-vk/exportropsten

core,cmd/utils: bugfix for ropsten dump imports
This commit is contained in:
Péter Szilágyi 2017-01-05 12:54:45 +02:00 committed by GitHub
commit bbce726c8a
3 changed files with 13 additions and 1 deletions

View File

@ -924,11 +924,19 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
chainDb = MakeChainDatabase(ctx, stack) chainDb = MakeChainDatabase(ctx, stack)
if ctx.GlobalBool(OlympicFlag.Name) { if ctx.GlobalBool(OlympicFlag.Name) {
_, err := core.WriteOlympicGenesisBlock(chainDb)
if err != nil {
glog.Fatalln(err)
}
}
if ctx.GlobalBool(TestNetFlag.Name) {
_, err := core.WriteTestNetGenesisBlock(chainDb) _, err := core.WriteTestNetGenesisBlock(chainDb)
if err != nil { if err != nil {
glog.Fatalln(err) glog.Fatalln(err)
} }
} }
chainConfig := MakeChainConfigFromDb(ctx, chainDb) chainConfig := MakeChainConfigFromDb(ctx, chainDb)
pow := pow.PoW(core.FakePow{}) pow := pow.PoW(core.FakePow{})

File diff suppressed because one or more lines are too long

View File

@ -172,7 +172,7 @@ func WriteDefaultGenesisBlock(chainDb ethdb.Database) (*types.Block, error) {
return WriteGenesisBlock(chainDb, strings.NewReader(DefaultGenesisBlock())) return WriteGenesisBlock(chainDb, strings.NewReader(DefaultGenesisBlock()))
} }
// WriteTestNetGenesisBlock assembles the Morden test network genesis block and // WriteTestNetGenesisBlock assembles the test network genesis block and
// writes it - along with all associated state - into a chain database. // writes it - along with all associated state - into a chain database.
func WriteTestNetGenesisBlock(chainDb ethdb.Database) (*types.Block, error) { func WriteTestNetGenesisBlock(chainDb ethdb.Database) (*types.Block, error) {
return WriteGenesisBlock(chainDb, strings.NewReader(DefaultTestnetGenesisBlock())) return WriteGenesisBlock(chainDb, strings.NewReader(DefaultTestnetGenesisBlock()))
@ -198,6 +198,8 @@ func DefaultGenesisBlock() string {
return string(blob) return string(blob)
} }
// DefaultTestnetGenesisBlock assembles a JSON string representing the default Ethereum
// test network genesis block.
func DefaultTestnetGenesisBlock() string { func DefaultTestnetGenesisBlock() string {
reader := bzip2.NewReader(base64.NewDecoder(base64.StdEncoding, strings.NewReader(defaultTestnetGenesisBlock))) reader := bzip2.NewReader(base64.NewDecoder(base64.StdEncoding, strings.NewReader(defaultTestnetGenesisBlock)))
blob, err := ioutil.ReadAll(reader) blob, err := ioutil.ReadAll(reader)