From ff69e0d57512779599708c71609dd3304962284e Mon Sep 17 00:00:00 2001 From: pasta Date: Tue, 18 Apr 2023 09:57:25 -0500 Subject: [PATCH] refactor: Spanify some governance APIs --- src/governance/governance.cpp | 7 +++---- src/governance/governance.h | 2 +- src/qt/governancelist.cpp | 2 +- src/qt/governancelist.h | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index fd026b84f5..f5a719c968 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -925,12 +925,11 @@ void CGovernanceManager::RequestGovernanceObject(CNode* pfrom, const uint256& nH int CGovernanceManager::RequestGovernanceObjectVotes(CNode& peer, CConnman& connman) { - std::vector vNodesCopy; - vNodesCopy.push_back(&peer); - return RequestGovernanceObjectVotes(vNodesCopy, connman); + std::array nodeCopy{&peer}; + return RequestGovernanceObjectVotes(nodeCopy, connman); } -int CGovernanceManager::RequestGovernanceObjectVotes(const std::vector& vNodesCopy, CConnman& connman) +int CGovernanceManager::RequestGovernanceObjectVotes(Span vNodesCopy, CConnman& connman) { static std::map > mapAskedRecently; diff --git a/src/governance/governance.h b/src/governance/governance.h index 80790c436e..1c8e203a78 100644 --- a/src/governance/governance.h +++ b/src/governance/governance.h @@ -347,7 +347,7 @@ public: void InitOnLoad(); int RequestGovernanceObjectVotes(CNode& peer, CConnman& connman); - int RequestGovernanceObjectVotes(const std::vector& vNodesCopy, CConnman& connman); + int RequestGovernanceObjectVotes(Span vNodesCopy, CConnman& connman); private: void RequestGovernanceObject(CNode* pfrom, const uint256& nHash, CConnman& connman, bool fUseFilter = false); diff --git a/src/qt/governancelist.cpp b/src/qt/governancelist.cpp index 9d1ec7524e..8cbbe58bcf 100644 --- a/src/qt/governancelist.cpp +++ b/src/qt/governancelist.cpp @@ -231,7 +231,7 @@ void ProposalModel::remove(int row) endRemoveRows(); } -void ProposalModel::reconcile(const std::vector& proposals) +void ProposalModel::reconcile(Span proposals) { // Vector of m_data.count() false values. Going through new proposals, // set keep_index true for each old proposal found in the new proposals. diff --git a/src/qt/governancelist.h b/src/qt/governancelist.h index 65834e54e5..5f407528bf 100644 --- a/src/qt/governancelist.h +++ b/src/qt/governancelist.h @@ -113,7 +113,7 @@ public: static int columnWidth(int section); void append(const Proposal* proposal); void remove(int row); - void reconcile(const std::vector& proposals); + void reconcile(Span proposals); void setVotingParams(int nAbsVoteReq); const Proposal* getProposalAt(const QModelIndex& index) const;