• Felix Lange's avatar
    core: refactor genesis handling · 37dd9086
    Felix Lange authored
    This commit solves several issues concerning the genesis block:
    
    * Genesis/ChainConfig loading was handled by cmd/geth code. This left
      library users in the cold. They could specify a JSON-encoded
      string and overwrite the config, but didn't get any of the additional
      checks performed by geth.
    * Decoding and writing of genesis JSON was conflated in
      WriteGenesisBlock. This made it a lot harder to embed the genesis
      block into the forthcoming config file loader. This commit changes
      things so there is a single Genesis type that represents genesis
      blocks. All uses of Write*Genesis* are changed to use the new type
      instead.
    * If the chain config supplied by the user was incompatible with the
      current chain (i.e. the chain had already advanced beyond a scheduled
      fork), it got overwritten. This is not an issue in practice because
      previous forks have always had the highest total difficulty. It might
      matter in the future though. The new code reverts the local chain to
      the point of the fork when upgrading configuration.
    
    The change to genesis block data removes compression library
    dependencies from package core.
    37dd9086
Name
Last commit
Last update
.github Loading commit data...
accounts Loading commit data...
build Loading commit data...
cmd Loading commit data...
common Loading commit data...
compression/rle Loading commit data...
console Loading commit data...
containers Loading commit data...
contracts Loading commit data...
core Loading commit data...
crypto Loading commit data...
eth Loading commit data...
ethclient Loading commit data...
ethdb Loading commit data...
ethstats Loading commit data...
event Loading commit data...
internal Loading commit data...
les Loading commit data...
light Loading commit data...
log Loading commit data...
metrics Loading commit data...
miner Loading commit data...
mobile Loading commit data...
node Loading commit data...
p2p Loading commit data...
params Loading commit data...
pow Loading commit data...
rlp Loading commit data...
rpc Loading commit data...
swarm Loading commit data...
tests Loading commit data...
trie Loading commit data...
vendor Loading commit data...
whisper Loading commit data...
.dockerignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
AUTHORS Loading commit data...
COPYING Loading commit data...
COPYING.LESSER Loading commit data...
Dockerfile Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
appveyor.yml Loading commit data...
circle.yml Loading commit data...
interfaces.go Loading commit data...