// New creates a new Obc* instance that provides the Consenter interface. // Internally, it uses an opaque pbft-core instance. func New(cpi consensus.CPI) consensus.Consenter { config := readConfig() addr, _, _ := cpi.GetReplicaHash() id, _ := cpi.GetReplicaID(addr) switch config.GetString("general.mode") { case "classic": return newObcClassic(id, config, cpi) case "batch": return newObcBatch(id, config, cpi) case "sieve": return newObcSieve(id, config, cpi) default: panic(fmt.Errorf("Invalid PBFT mode: %s", config.GetString("general.mode"))) } }
// New creates a new Obc* instance that provides the Consenter interface. // Internally, it uses an opaque pbft-core instance. func New(cpi consensus.CPI) consensus.Consenter { config = loadConfig() handle, _, _ := cpi.GetNetworkHandles() id, _ := getValidatorID(handle) switch config.GetString("general.mode") { case "classic": return newObcClassic(id, config, cpi) case "batch": return newObcBatch(id, config, cpi) case "sieve": return newObcSieve(id, config, cpi) default: panic(fmt.Errorf("Invalid PBFT mode: %s", config.GetString("general.mode"))) } }