Example #1
0
func makeSwitch(i int, network, version string, initSwitch func(int, *Switch) *Switch) *Switch {
	privKey := crypto.GenPrivKeyEd25519()
	// new switch, add reactors
	// TODO: let the config be passed in?
	s := initSwitch(i, NewSwitch(cfg.NewMapConfig(nil)))
	s.SetNodeInfo(&NodeInfo{
		PubKey:  privKey.PubKey().(crypto.PubKeyEd25519),
		Moniker: Fmt("switch%d", i),
		Network: network,
		Version: version,
	})
	s.SetNodePrivKey(privKey)
	return s
}
Example #2
0
func init() {
	config = cfg.NewMapConfig(nil)
	setConfigDefaults(config)

}