refactor: Spanify some governance APIs

This commit is contained in:
pasta 2023-04-18 09:57:25 -05:00 committed by UdjinM6
parent f92e51b4c5
commit ff69e0d575
4 changed files with 6 additions and 7 deletions

View File

@ -925,12 +925,11 @@ void CGovernanceManager::RequestGovernanceObject(CNode* pfrom, const uint256& nH
int CGovernanceManager::RequestGovernanceObjectVotes(CNode& peer, CConnman& connman) int CGovernanceManager::RequestGovernanceObjectVotes(CNode& peer, CConnman& connman)
{ {
std::vector<CNode*> vNodesCopy; std::array<CNode*, 1> nodeCopy{&peer};
vNodesCopy.push_back(&peer); return RequestGovernanceObjectVotes(nodeCopy, connman);
return RequestGovernanceObjectVotes(vNodesCopy, connman);
} }
int CGovernanceManager::RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesCopy, CConnman& connman) int CGovernanceManager::RequestGovernanceObjectVotes(Span<CNode*> vNodesCopy, CConnman& connman)
{ {
static std::map<uint256, std::map<CService, int64_t> > mapAskedRecently; static std::map<uint256, std::map<CService, int64_t> > mapAskedRecently;

View File

@ -347,7 +347,7 @@ public:
void InitOnLoad(); void InitOnLoad();
int RequestGovernanceObjectVotes(CNode& peer, CConnman& connman); int RequestGovernanceObjectVotes(CNode& peer, CConnman& connman);
int RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesCopy, CConnman& connman); int RequestGovernanceObjectVotes(Span<CNode*> vNodesCopy, CConnman& connman);
private: private:
void RequestGovernanceObject(CNode* pfrom, const uint256& nHash, CConnman& connman, bool fUseFilter = false); void RequestGovernanceObject(CNode* pfrom, const uint256& nHash, CConnman& connman, bool fUseFilter = false);

View File

@ -231,7 +231,7 @@ void ProposalModel::remove(int row)
endRemoveRows(); endRemoveRows();
} }
void ProposalModel::reconcile(const std::vector<const Proposal*>& proposals) void ProposalModel::reconcile(Span<const Proposal*> proposals)
{ {
// Vector of m_data.count() false values. Going through new 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. // set keep_index true for each old proposal found in the new proposals.

View File

@ -113,7 +113,7 @@ public:
static int columnWidth(int section); static int columnWidth(int section);
void append(const Proposal* proposal); void append(const Proposal* proposal);
void remove(int row); void remove(int row);
void reconcile(const std::vector<const Proposal*>& proposals); void reconcile(Span<const Proposal*> proposals);
void setVotingParams(int nAbsVoteReq); void setVotingParams(int nAbsVoteReq);
const Proposal* getProposalAt(const QModelIndex& index) const; const Proposal* getProposalAt(const QModelIndex& index) const;