コード例 #1
0
ファイル: controller.go プロジェクト: butine/research
// NewConsenter constructs a Consenter object
func NewConsenter(stack consensus.Stack) (consenter consensus.Consenter) {
	plugin := viper.GetString("peer.validator.consensus")
	if plugin == "obcpbft" {
		//logger.Info("Running with consensus plugin %s", plugin)
		consenter = obcpbft.GetPlugin(stack)
	} else {
		//logger.Info("Running with default consensus plugin (noops)")
		consenter = noops.GetNoops(stack)
	}
	return
}
コード例 #2
0
ファイル: controller.go プロジェクト: masterDev1985/obc-peer
// NewConsenter constructs a consenter object.
// Called by handler.NewConsensusHandler().
func NewConsenter(cpi consensus.CPI) consensus.Consenter {
	plugin := viper.GetString("peer.validator.consensus")
	var algo consensus.Consenter
	if plugin == "obcpbft" {
		logger.Debug("Running with OBC-PBFT consensus")
		algo = obcpbft.GetPlugin(cpi)
	} else {
		logger.Debug("Running with NOOPS consensus")
		algo = noops.GetNoops(cpi)
	}
	return algo
}