parent
21140191da
commit
8117032c67
|
@ -245,7 +245,12 @@ template to(a: string, b: type UInt256): UInt256 =
|
|||
UInt256.fromHex(a)
|
||||
|
||||
proc loadNetworkParams*(cc: CustomChain, cg: var NetworkParams): bool =
|
||||
cg.genesis = cc.genesis
|
||||
if cc.genesis.isNil:
|
||||
cg.genesis = Genesis()
|
||||
warn "Loaded custom network configuration contains no 'genesis' data"
|
||||
else:
|
||||
cg.genesis = cc.genesis
|
||||
|
||||
cg.config = ChainConfig()
|
||||
cg.config.chainId = cc.config.chainId
|
||||
cg.config.daoForkSupport = cc.config.daoForkSupport
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"config": {
|
||||
"chainId": 7,
|
||||
"homesteadBlock": 0,
|
||||
"eip150Block": 0,
|
||||
"eip150Hash": "0x5de1ee4135274003348e80b788e5afa4b18b18d320a5622218d5c493fedf5689",
|
||||
"eip155Block": 0,
|
||||
"eip158Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"muirGlacierBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 0,
|
||||
"clique": {
|
||||
"epoch": 3000,
|
||||
"period": 1
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import
|
||||
std/[os],
|
||||
pkg/[unittest2, confutils],
|
||||
pkg/[unittest2],
|
||||
eth/[p2p, common, keys],
|
||||
stew/byteutils,
|
||||
../nimbus/[config, chain_config, context],
|
||||
|
@ -12,7 +12,10 @@ proc `==`(a, b: ChainId): bool =
|
|||
proc configurationMain*() =
|
||||
suite "configuration test suite":
|
||||
const
|
||||
genesisFile = "tests" / "customgenesis" / "calaveras.json"
|
||||
jsonDir = "tests" / "customgenesis"
|
||||
genesisFile = jsonDir / "calaveras.json"
|
||||
noGenesis = jsonDir / "nogenesis.json"
|
||||
noConfig = jsonDir / "noconfig.json"
|
||||
bootNode = "enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303"
|
||||
|
||||
test "data-dir and key-store":
|
||||
|
@ -49,6 +52,14 @@ proc configurationMain*() =
|
|||
check bb.cmd == NimbusCmd.`import`
|
||||
check bb.blocksFile.string == genesisFile
|
||||
|
||||
test "custom-network loading config file with no genesis data":
|
||||
let conf = makeConfig(@["--custom-network:" & noGenesis])
|
||||
check conf.networkParams.genesis.isNil == false
|
||||
|
||||
test "custom-network loading config file with no 'config'":
|
||||
let conf = makeConfig(@["--custom-network:" & noConfig])
|
||||
check conf.networkParams.config.isNil == false
|
||||
|
||||
test "network-id":
|
||||
let aa = makeTestConfig()
|
||||
check aa.networkId == MainNet
|
||||
|
|
Loading…
Reference in New Issue