Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #include "consensus/yac/supermajority_checker.hpp"
7 :
8 : #include "consensus/yac/impl/supermajority_checker_bft.hpp"
9 : #include "consensus/yac/impl/supermajority_checker_cft.hpp"
10 :
11 : namespace iroha {
12 : namespace consensus {
13 : namespace yac {
14 :
15 : std::unique_ptr<SupermajorityChecker> getSupermajorityChecker(
16 : ConsistencyModel c) {
17 532 : switch (c) {
18 : case ConsistencyModel::kCft:
19 2 : return std::make_unique<SupermajorityCheckerCft>();
20 : case ConsistencyModel::kBft:
21 530 : return std::make_unique<SupermajorityCheckerBft>();
22 : default:
23 0 : throw(std::runtime_error("Unknown consistency model requested!"));
24 : }
25 532 : }
26 :
27 : } // namespace yac
28 : } // namespace consensus
29 : } // namespace iroha
|