Exemple #1
0
// 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
}
Exemple #2
0
// 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
}