Skip to content

Commit daba957

Browse files
theStackaureleoules
authored andcommitted
refactor: Make ListSelected return vector
1 parent 9477662 commit daba957

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

src/qt/coincontroldialog.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel *
412412
unsigned int nQuantity = 0;
413413
bool fWitness = false;
414414

415-
std::vector<COutPoint> vCoinControl;
416-
m_coin_control.ListSelected(vCoinControl);
415+
auto vCoinControl{m_coin_control.ListSelected()};
417416

418417
size_t i = 0;
419418
for (const auto& out : model->wallet().getCoins(vCoinControl)) {

src/wallet/coincontrol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ void CCoinControl::UnSelectAll()
5858
m_selected_inputs.clear();
5959
}
6060

61-
void CCoinControl::ListSelected(std::vector<COutPoint>& vOutpoints) const
61+
std::vector<COutPoint> CCoinControl::ListSelected() const
6262
{
63-
vOutpoints.assign(m_selected_inputs.begin(), m_selected_inputs.end());
63+
return {m_selected_inputs.begin(), m_selected_inputs.end()};
6464
}
6565

6666
void CCoinControl::SetInputWeight(const COutPoint& outpoint, int64_t weight)

src/wallet/coincontrol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class CCoinControl
100100
/**
101101
* List the selected inputs.
102102
*/
103-
void ListSelected(std::vector<COutPoint>& vOutpoints) const;
103+
std::vector<COutPoint> ListSelected() const;
104104
/**
105105
* Set an input's weight.
106106
*/

src/wallet/spend.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ util::Result<PreSelectedInputs> FetchSelectedInputs(const CWallet& wallet, const
159159
const CoinSelectionParams& coin_selection_params) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
160160
{
161161
PreSelectedInputs result;
162-
std::vector<COutPoint> vPresetInputs;
163-
coin_control.ListSelected(vPresetInputs);
164162
const bool can_grind_r = wallet.CanGrindR();
165-
for (const COutPoint& outpoint : vPresetInputs) {
163+
for (const COutPoint& outpoint : coin_control.ListSelected()) {
166164
int input_bytes = -1;
167165
CTxOut txout;
168166
if (auto ptr_wtx = wallet.GetWalletTx(outpoint.hash)) {

0 commit comments

Comments
 (0)