Skip to content

Commit

Permalink
refactor: Spanify some governance APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta authored and UdjinM6 committed Apr 18, 2023
1 parent f92e51b commit ff69e0d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/governance/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,11 @@ void CGovernanceManager::RequestGovernanceObject(CNode* pfrom, const uint256& nH

int CGovernanceManager::RequestGovernanceObjectVotes(CNode& peer, CConnman& connman)
{
std::vector<CNode*> vNodesCopy;
vNodesCopy.push_back(&peer);
return RequestGovernanceObjectVotes(vNodesCopy, connman);
std::array<CNode*, 1> nodeCopy{&peer};
return RequestGovernanceObjectVotes(nodeCopy, 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;

Expand Down
2 changes: 1 addition & 1 deletion src/governance/governance.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class CGovernanceManager
void InitOnLoad();

int RequestGovernanceObjectVotes(CNode& peer, CConnman& connman);
int RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesCopy, CConnman& connman);
int RequestGovernanceObjectVotes(Span<CNode*> vNodesCopy, CConnman& connman);

private:
void RequestGovernanceObject(CNode* pfrom, const uint256& nHash, CConnman& connman, bool fUseFilter = false);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/governancelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void ProposalModel::remove(int row)
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,
// set keep_index true for each old proposal found in the new proposals.
Expand Down
2 changes: 1 addition & 1 deletion src/qt/governancelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ProposalModel : public QAbstractTableModel
static int columnWidth(int section);
void append(const Proposal* proposal);
void remove(int row);
void reconcile(const std::vector<const Proposal*>& proposals);
void reconcile(Span<const Proposal*> proposals);
void setVotingParams(int nAbsVoteReq);

const Proposal* getProposalAt(const QModelIndex& index) const;
Expand Down

0 comments on commit ff69e0d

Please sign in to comment.