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:
Jeffrey Wilcke
2016-03-01 23:32:43 +01:00
committed by Jeffrey Wilcke
parent 10d3466c93
commit f0cbebb19f
55 changed files with 732 additions and 431 deletions

View File

@ -124,7 +124,7 @@ func (self *StateTransition) from() (vm.Account, error) {
f common.Address
err error
)
if params.IsHomestead(self.env.BlockNumber()) {
if self.env.RuleSet().IsHomestead(self.env.BlockNumber()) {
f, err = self.msg.From()
} else {
f, err = self.msg.FromFrontier()
@ -216,7 +216,7 @@ func (self *StateTransition) transitionDb() (ret []byte, usedGas *big.Int, err e
msg := self.msg
sender, _ := self.from() // err checked in preCheck
homestead := params.IsHomestead(self.env.BlockNumber())
homestead := self.env.RuleSet().IsHomestead(self.env.BlockNumber())
contractCreation := MessageCreatesContract(msg)
// Pay intrinsic gas
if err = self.useGas(IntrinsicGas(self.data, contractCreation, homestead)); err != nil {