aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-01-23 17:00:14 +0100
committerAurèle Oulès <aurele@oules.com>2023-04-26 10:41:10 +0200
commitdaba95700b0b77a2e898299f218c47a69ed2c7d0 (patch)
tree143bee3f3b96983e33fb7c7b2ebb3756f0fe417c /src
parent94776621ba6a79f3197ec71250bc48e974ad5e4a (diff)
refactor: Make ListSelected return vector
Diffstat (limited to 'src')
-rw-r--r--src/qt/coincontroldialog.cpp3
-rw-r--r--src/wallet/coincontrol.cpp4
-rw-r--r--src/wallet/coincontrol.h2
-rw-r--r--src/wallet/spend.cpp4
4 files changed, 5 insertions, 8 deletions
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index e1b1ae12e9..50d3c2e559 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -412,8 +412,7 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel *
unsigned int nQuantity = 0;
bool fWitness = false;
- std::vector<COutPoint> vCoinControl;
- m_coin_control.ListSelected(vCoinControl);
+ auto vCoinControl{m_coin_control.ListSelected()};
size_t i = 0;
for (const auto& out : model->wallet().getCoins(vCoinControl)) {
diff --git a/src/wallet/coincontrol.cpp b/src/wallet/coincontrol.cpp
index d87b54e35c..2087119db9 100644
--- a/src/wallet/coincontrol.cpp
+++ b/src/wallet/coincontrol.cpp
@@ -58,9 +58,9 @@ void CCoinControl::UnSelectAll()
m_selected_inputs.clear();
}
-void CCoinControl::ListSelected(std::vector<COutPoint>& vOutpoints) const
+std::vector<COutPoint> CCoinControl::ListSelected() const
{
- vOutpoints.assign(m_selected_inputs.begin(), m_selected_inputs.end());
+ return {m_selected_inputs.begin(), m_selected_inputs.end()};
}
void CCoinControl::SetInputWeight(const COutPoint& outpoint, int64_t weight)
diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h
index 0a860dd782..7ff8fee5bc 100644
--- a/src/wallet/coincontrol.h
+++ b/src/wallet/coincontrol.h
@@ -100,7 +100,7 @@ public:
/**
* List the selected inputs.
*/
- void ListSelected(std::vector<COutPoint>& vOutpoints) const;
+ std::vector<COutPoint> ListSelected() const;
/**
* Set an input's weight.
*/
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 7379490f9b..b14a30921b 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -159,10 +159,8 @@ util::Result<PreSelectedInputs> FetchSelectedInputs(const CWallet& wallet, const
const CoinSelectionParams& coin_selection_params) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
{
PreSelectedInputs result;
- std::vector<COutPoint> vPresetInputs;
- coin_control.ListSelected(vPresetInputs);
const bool can_grind_r = wallet.CanGrindR();
- for (const COutPoint& outpoint : vPresetInputs) {
+ for (const COutPoint& outpoint : coin_control.ListSelected()) {
int input_bytes = -1;
CTxOut txout;
if (auto ptr_wtx = wallet.GetWalletTx(outpoint.hash)) {