refactor: Make ListSelected return vector

This commit is contained in:
Sebastian Falbesoner 2023-01-23 17:00:14 +01:00 committed by Aurèle Oulès
parent 94776621ba
commit daba95700b
4 changed files with 5 additions and 8 deletions

View file

@ -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)) {

View file

@ -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)

View file

@ -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.
*/

View file

@ -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)) {