core: added basic chain configuration
Added chain configuration options and write out during genesis database insertion. If no "config" was found, nothing is written to the database. Configurations are written on a per genesis base. This means that any chain (which is identified by it's genesis hash) can have their own chain settings.
This commit is contained in:
committed by
Jeffrey Wilcke
parent
10d3466c93
commit
f0cbebb19f
@ -108,7 +108,7 @@ type btTransaction struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
func RunBlockTestWithReader(r io.Reader, skipTests []string) error {
|
||||
func RunBlockTestWithReader(homesteadBlock *big.Int, r io.Reader, skipTests []string) error {
|
||||
btjs := make(map[string]*btJSON)
|
||||
if err := readJson(r, &btjs); err != nil {
|
||||
return err
|
||||
@ -119,13 +119,13 @@ func RunBlockTestWithReader(r io.Reader, skipTests []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := runBlockTests(bt, skipTests); err != nil {
|
||||
if err := runBlockTests(homesteadBlock, bt, skipTests); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func RunBlockTest(file string, skipTests []string) error {
|
||||
func RunBlockTest(homesteadBlock *big.Int, file string, skipTests []string) error {
|
||||
btjs := make(map[string]*btJSON)
|
||||
if err := readJsonFile(file, &btjs); err != nil {
|
||||
return err
|
||||
@ -135,13 +135,13 @@ func RunBlockTest(file string, skipTests []string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := runBlockTests(bt, skipTests); err != nil {
|
||||
if err := runBlockTests(homesteadBlock, bt, skipTests); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func runBlockTests(bt map[string]*BlockTest, skipTests []string) error {
|
||||
func runBlockTests(homesteadBlock *big.Int, bt map[string]*BlockTest, skipTests []string) error {
|
||||
skipTest := make(map[string]bool, len(skipTests))
|
||||
for _, name := range skipTests {
|
||||
skipTest[name] = true
|
||||
@ -153,7 +153,7 @@ func runBlockTests(bt map[string]*BlockTest, skipTests []string) error {
|
||||
continue
|
||||
}
|
||||
// test the block
|
||||
if err := runBlockTest(test); err != nil {
|
||||
if err := runBlockTest(homesteadBlock, test); err != nil {
|
||||
return fmt.Errorf("%s: %v", name, err)
|
||||
}
|
||||
glog.Infoln("Block test passed: ", name)
|
||||
@ -162,7 +162,7 @@ func runBlockTests(bt map[string]*BlockTest, skipTests []string) error {
|
||||
return nil
|
||||
|
||||
}
|
||||
func runBlockTest(test *BlockTest) error {
|
||||
func runBlockTest(homesteadBlock *big.Int, test *BlockTest) error {
|
||||
ks := crypto.NewKeyStorePassphrase(filepath.Join(common.DefaultDataDir(), "keystore"), crypto.StandardScryptN, crypto.StandardScryptP)
|
||||
am := accounts.NewManager(ks)
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
@ -174,6 +174,7 @@ func runBlockTest(test *BlockTest) error {
|
||||
}
|
||||
|
||||
cfg := ð.Config{
|
||||
ChainConfig: &core.ChainConfig{HomesteadBlock: homesteadBlock},
|
||||
TestGenesisState: db,
|
||||
TestGenesisBlock: test.Genesis,
|
||||
Etherbase: common.Address{},
|
||||
|
Reference in New Issue
Block a user