Skip to content

Commit 2acad03

Browse files
committed
Remove OutputGroup non-default constructors
1 parent de4b7f2 commit 2acad03

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

src/bench/coin_selection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ static void CoinSelection(benchmark::Bench& bench)
4646
std::vector<OutputGroup> groups;
4747
for (const auto& wtx : wtxs) {
4848
COutput output(wtx.get(), 0 /* iIn */, 6 * 24 /* nDepthIn */, true /* spendable */, true /* solvable */, true /* safe */);
49-
groups.emplace_back(output.GetInputCoin(), 6, false, 0, 0);
49+
groups.emplace_back();
50+
groups.back().Insert(output.GetInputCoin(), 6, false, 0, 0);
5051
}
5152

5253
const CoinEligibilityFilter filter_standard(1, 6, 0);
@@ -75,7 +76,8 @@ static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>
7576
tx.vout.resize(nInput + 1);
7677
tx.vout[nInput].nValue = nValue;
7778
std::unique_ptr<CWalletTx> wtx = MakeUnique<CWalletTx>(&testWallet, MakeTransactionRef(std::move(tx)));
78-
set.emplace_back(COutput(wtx.get(), nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0);
79+
set.emplace_back();
80+
set.back().Insert(COutput(wtx.get(), nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0);
7981
wtxn.emplace_back(std::move(wtx));
8082
}
8183
// Copied from src/wallet/test/coinselector_tests.cpp

src/wallet/coinselection.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,6 @@ struct OutputGroup
8181
CAmount long_term_fee{0};
8282

8383
OutputGroup() {}
84-
OutputGroup(std::vector<CInputCoin>&& outputs, bool from_me, CAmount value, int depth, size_t ancestors, size_t descendants)
85-
: m_outputs(std::move(outputs))
86-
, m_from_me(from_me)
87-
, m_value(value)
88-
, m_depth(depth)
89-
, m_ancestors(ancestors)
90-
, m_descendants(descendants)
91-
{}
92-
OutputGroup(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants) : OutputGroup() {
93-
Insert(output, depth, from_me, ancestors, descendants);
94-
}
9584
void Insert(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants);
9685
std::vector<CInputCoin>::iterator Discard(const CInputCoin& output);
9786
bool EligibleForSpending(const CoinEligibilityFilter& eligibility_filter) const;

src/wallet/test/coinselector_tests.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,21 @@ inline std::vector<OutputGroup>& GroupCoins(const std::vector<CInputCoin>& coins
114114
{
115115
static std::vector<OutputGroup> static_groups;
116116
static_groups.clear();
117-
for (auto& coin : coins) static_groups.emplace_back(coin, 0, true, 0, 0);
117+
for (auto& coin : coins) {
118+
static_groups.emplace_back();
119+
static_groups.back().Insert(coin, 0, true, 0, 0);
120+
}
118121
return static_groups;
119122
}
120123

121124
inline std::vector<OutputGroup>& GroupCoins(const std::vector<COutput>& coins)
122125
{
123126
static std::vector<OutputGroup> static_groups;
124127
static_groups.clear();
125-
for (auto& coin : coins) static_groups.emplace_back(coin.GetInputCoin(), coin.nDepth, coin.tx->m_amounts[CWalletTx::DEBIT].m_cached[ISMINE_SPENDABLE] && coin.tx->m_amounts[CWalletTx::DEBIT].m_value[ISMINE_SPENDABLE] == 1 /* HACK: we can't figure out the is_me flag so we use the conditions defined above; perhaps set safe to false for !fIsFromMe in add_coin() */, 0, 0);
128+
for (auto& coin : coins) {
129+
static_groups.emplace_back();
130+
static_groups.back().Insert(coin.GetInputCoin(), coin.nDepth, coin.tx->m_amounts[CWalletTx::DEBIT].m_cached[ISMINE_SPENDABLE] && coin.tx->m_amounts[CWalletTx::DEBIT].m_value[ISMINE_SPENDABLE] == 1 /* HACK: we can't figure out the is_me flag so we use the conditions defined above; perhaps set safe to false for !fIsFromMe in add_coin() */, 0, 0);
131+
}
126132
return static_groups;
127133
}
128134

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4233,7 +4233,8 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
42334233
gmap[dst].Insert(input_coin, output.nDepth, output.tx->IsFromMe(ISMINE_ALL), ancestors, descendants);
42344234
}
42354235
} else {
4236-
groups.emplace_back(input_coin, output.nDepth, output.tx->IsFromMe(ISMINE_ALL), ancestors, descendants);
4236+
groups.emplace_back();
4237+
groups.back().Insert(input_coin, output.nDepth, output.tx->IsFromMe(ISMINE_ALL), ancestors, descendants);
42374238
}
42384239
}
42394240
}

0 commit comments

Comments
 (0)