mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
Remove OutputGroup non-default constructors
This commit is contained in:
parent
de4b7f25ac
commit
2acad03657
4 changed files with 14 additions and 16 deletions
|
@ -46,7 +46,8 @@ static void CoinSelection(benchmark::Bench& bench)
|
|||
std::vector<OutputGroup> groups;
|
||||
for (const auto& wtx : wtxs) {
|
||||
COutput output(wtx.get(), 0 /* iIn */, 6 * 24 /* nDepthIn */, true /* spendable */, true /* solvable */, true /* safe */);
|
||||
groups.emplace_back(output.GetInputCoin(), 6, false, 0, 0);
|
||||
groups.emplace_back();
|
||||
groups.back().Insert(output.GetInputCoin(), 6, false, 0, 0);
|
||||
}
|
||||
|
||||
const CoinEligibilityFilter filter_standard(1, 6, 0);
|
||||
|
@ -75,7 +76,8 @@ static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>
|
|||
tx.vout.resize(nInput + 1);
|
||||
tx.vout[nInput].nValue = nValue;
|
||||
std::unique_ptr<CWalletTx> wtx = MakeUnique<CWalletTx>(&testWallet, MakeTransactionRef(std::move(tx)));
|
||||
set.emplace_back(COutput(wtx.get(), nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0);
|
||||
set.emplace_back();
|
||||
set.back().Insert(COutput(wtx.get(), nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0);
|
||||
wtxn.emplace_back(std::move(wtx));
|
||||
}
|
||||
// Copied from src/wallet/test/coinselector_tests.cpp
|
||||
|
|
|
@ -81,17 +81,6 @@ struct OutputGroup
|
|||
CAmount long_term_fee{0};
|
||||
|
||||
OutputGroup() {}
|
||||
OutputGroup(std::vector<CInputCoin>&& outputs, bool from_me, CAmount value, int depth, size_t ancestors, size_t descendants)
|
||||
: m_outputs(std::move(outputs))
|
||||
, m_from_me(from_me)
|
||||
, m_value(value)
|
||||
, m_depth(depth)
|
||||
, m_ancestors(ancestors)
|
||||
, m_descendants(descendants)
|
||||
{}
|
||||
OutputGroup(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants) : OutputGroup() {
|
||||
Insert(output, depth, from_me, ancestors, descendants);
|
||||
}
|
||||
void Insert(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants);
|
||||
std::vector<CInputCoin>::iterator Discard(const CInputCoin& output);
|
||||
bool EligibleForSpending(const CoinEligibilityFilter& eligibility_filter) const;
|
||||
|
|
|
@ -114,7 +114,10 @@ inline std::vector<OutputGroup>& GroupCoins(const std::vector<CInputCoin>& coins
|
|||
{
|
||||
static std::vector<OutputGroup> static_groups;
|
||||
static_groups.clear();
|
||||
for (auto& coin : coins) static_groups.emplace_back(coin, 0, true, 0, 0);
|
||||
for (auto& coin : coins) {
|
||||
static_groups.emplace_back();
|
||||
static_groups.back().Insert(coin, 0, true, 0, 0);
|
||||
}
|
||||
return static_groups;
|
||||
}
|
||||
|
||||
|
@ -122,7 +125,10 @@ inline std::vector<OutputGroup>& GroupCoins(const std::vector<COutput>& coins)
|
|||
{
|
||||
static std::vector<OutputGroup> static_groups;
|
||||
static_groups.clear();
|
||||
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);
|
||||
for (auto& coin : coins) {
|
||||
static_groups.emplace_back();
|
||||
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);
|
||||
}
|
||||
return static_groups;
|
||||
}
|
||||
|
||||
|
|
|
@ -4233,7 +4233,8 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
|
|||
gmap[dst].Insert(input_coin, output.nDepth, output.tx->IsFromMe(ISMINE_ALL), ancestors, descendants);
|
||||
}
|
||||
} else {
|
||||
groups.emplace_back(input_coin, output.nDepth, output.tx->IsFromMe(ISMINE_ALL), ancestors, descendants);
|
||||
groups.emplace_back();
|
||||
groups.back().Insert(input_coin, output.nDepth, output.tx->IsFromMe(ISMINE_ALL), ancestors, descendants);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue