mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
ethash: add isPrivateNetwork test
This commit is contained in:
parent
68e62fa804
commit
5f4ef4fda2
1 changed files with 18 additions and 0 deletions
|
|
@ -84,3 +84,21 @@ func TestCalcDifficulty(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIsPrivateNetwork(t *testing.T) {
|
||||||
|
tests := make(map[*big.Int]bool)
|
||||||
|
|
||||||
|
tests[big.NewInt(314)] = true
|
||||||
|
tests[params.MainnetChainConfig.ChainID] = false
|
||||||
|
tests[params.TestChainConfig.ChainID] = false
|
||||||
|
tests[params.RinkebyChainConfig.ChainID] = false
|
||||||
|
|
||||||
|
for chainID, expected := range tests {
|
||||||
|
config := ¶ms.ChainConfig{ChainID: chainID}
|
||||||
|
|
||||||
|
isPrivate := isPrivateNetwork(config)
|
||||||
|
if isPrivate != expected {
|
||||||
|
t.Error("Private chain test failed. Expected", expected, "but determined", isPrivate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue