|
4 | 4 |
|
5 | 5 | #include <evo/simplifiedmns.h> |
6 | 6 |
|
| 7 | +#include <clientversion.h> |
7 | 8 | #include <consensus/merkle.h> |
8 | | -#include <evo/deterministicmns.h> |
9 | 9 | #include <key_io.h> |
10 | 10 | #include <pubkey.h> |
11 | 11 | #include <serialize.h> |
12 | 12 | #include <univalue.h> |
13 | 13 | #include <util/underlying.h> |
14 | 14 | #include <version.h> |
15 | 15 |
|
16 | | -CSimplifiedMNListEntry::CSimplifiedMNListEntry(const CDeterministicMN& dmn) : |
17 | | - proRegTxHash(dmn.proTxHash), |
18 | | - confirmedHash(dmn.pdmnState->confirmedHash), |
19 | | - netInfo(dmn.pdmnState->netInfo), |
20 | | - pubKeyOperator(dmn.pdmnState->pubKeyOperator), |
21 | | - keyIDVoting(dmn.pdmnState->keyIDVoting), |
22 | | - isValid(!dmn.pdmnState->IsBanned()), |
23 | | - platformHTTPPort(dmn.pdmnState->platformHTTPPort), |
24 | | - platformNodeID(dmn.pdmnState->platformNodeID), |
25 | | - scriptPayout(dmn.pdmnState->scriptPayout), |
26 | | - scriptOperatorPayout(dmn.pdmnState->scriptOperatorPayout), |
27 | | - nVersion(dmn.pdmnState->nVersion), |
28 | | - nType(dmn.nType) |
| 16 | +CSimplifiedMNListEntry::CSimplifiedMNListEntry(const uint256& proreg_tx_hash, const uint256& confirmed_hash, |
| 17 | + MnNetInfo net_info, const CBLSLazyPublicKey& pubkey_operator, |
| 18 | + const CKeyID& keyid_voting, bool is_valid, uint16_t platform_http_port, |
| 19 | + const uint160& platform_node_id, const CScript& script_payout, |
| 20 | + const CScript& script_operator_payout, uint16_t version, MnType type) : |
| 21 | + proRegTxHash(proreg_tx_hash), |
| 22 | + confirmedHash(confirmed_hash), |
| 23 | + netInfo(net_info), |
| 24 | + pubKeyOperator(pubkey_operator), |
| 25 | + keyIDVoting(keyid_voting), |
| 26 | + isValid(is_valid), |
| 27 | + platformHTTPPort(platform_http_port), |
| 28 | + platformNodeID(platform_node_id), |
| 29 | + scriptPayout(script_payout), |
| 30 | + scriptOperatorPayout(script_operator_payout), |
| 31 | + nVersion(version), |
| 32 | + nType(type) |
29 | 33 | { |
30 | 34 | } |
31 | 35 |
|
@@ -57,24 +61,9 @@ std::string CSimplifiedMNListEntry::ToString() const |
57 | 61 | operatorPayoutAddress, platformHTTPPort, platformNodeID.ToString(), netInfo.ToString()); |
58 | 62 | } |
59 | 63 |
|
60 | | -CSimplifiedMNList::CSimplifiedMNList(const std::vector<CSimplifiedMNListEntry>& smlEntries) |
| 64 | +CSimplifiedMNList::CSimplifiedMNList(std::vector<std::unique_ptr<CSimplifiedMNListEntry>>&& smlEntries) |
61 | 65 | { |
62 | | - mnList.reserve(smlEntries.size()); |
63 | | - for (const auto& entry : smlEntries) { |
64 | | - mnList.emplace_back(std::make_unique<CSimplifiedMNListEntry>(entry)); |
65 | | - } |
66 | | - |
67 | | - std::sort(mnList.begin(), mnList.end(), [&](const std::unique_ptr<CSimplifiedMNListEntry>& a, const std::unique_ptr<CSimplifiedMNListEntry>& b) { |
68 | | - return a->proRegTxHash.Compare(b->proRegTxHash) < 0; |
69 | | - }); |
70 | | -} |
71 | | - |
72 | | -CSimplifiedMNList::CSimplifiedMNList(const CDeterministicMNList& dmnList) |
73 | | -{ |
74 | | - mnList.reserve(dmnList.GetAllMNsCount()); |
75 | | - dmnList.ForEachMN(false, [this](auto& dmn) { |
76 | | - mnList.emplace_back(std::make_unique<CSimplifiedMNListEntry>(dmn)); |
77 | | - }); |
| 66 | + mnList = std::move(smlEntries); |
78 | 67 |
|
79 | 68 | std::sort(mnList.begin(), mnList.end(), [&](const std::unique_ptr<CSimplifiedMNListEntry>& a, const std::unique_ptr<CSimplifiedMNListEntry>& b) { |
80 | 69 | return a->proRegTxHash.Compare(b->proRegTxHash) < 0; |
|
0 commit comments