More comments addressed

This commit is contained in:
Yuriy Glukhov 2018-08-03 14:10:07 +03:00
parent 39d604a8d7
commit db62ef132e
2 changed files with 9 additions and 4 deletions

View File

@ -8,7 +8,7 @@
# those terms. # those terms.
import parseopt, strutils, macros import parseopt, strutils, macros
import asyncdispatch2, eth_keys, eth_p2p, eth_common import asyncdispatch2, eth_keys, eth_p2p, eth_common, chronicles
const const
NimbusName* = "Nimbus" NimbusName* = "Nimbus"
@ -193,7 +193,9 @@ proc publicChainConfig*(id: PublicNetwork): ChainConfig =
byzantiumBlock: 1035301.u256 byzantiumBlock: 1035301.u256
) )
else: else:
raise newException(Exception, "No chain config for " & $id) error "No chain config for public network", networkId = id
doAssert(false, "No chain config for " & $id)
ChainConfig()
result.chainId = uint(id) result.chainId = uint(id)

View File

@ -30,7 +30,7 @@ func decodePrealloc(data: seq[byte]): GenesisAlloc =
for tup in rlp.decode(data.toRange, seq[(UInt256, UInt256)]): for tup in rlp.decode(data.toRange, seq[(UInt256, UInt256)]):
result[toAddress(tup[0])] = GenesisAccount(balance: tup[1]) result[toAddress(tup[0])] = GenesisAccount(balance: tup[1])
func defaultGenesisBlockForNetwork*(id: PublicNetwork): Genesis = proc defaultGenesisBlockForNetwork*(id: PublicNetwork): Genesis =
result = case id result = case id
of MainNet: of MainNet:
Genesis( Genesis(
@ -57,7 +57,10 @@ func defaultGenesisBlockForNetwork*(id: PublicNetwork): Genesis =
alloc: decodePrealloc(rinkebyAllocData) alloc: decodePrealloc(rinkebyAllocData)
) )
else: else:
raise newException(Exception, "No default genesis for " & $id) # TODO: Fill out the rest
error "No default genesis for network", id
doAssert(false, "No default genesis for " & $id)
Genesis()
result.config = publicChainConfig(id) result.config = publicChainConfig(id)
proc toBlock*(g: Genesis): BlockHeader = proc toBlock*(g: Genesis): BlockHeader =