Skip to content

Commit f6c39c6

Browse files
committed
coinselection: Remove CInputCoin
It is no longer needed as everything it was doing is now done by COutput
1 parent 70f31f1 commit f6c39c6

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

src/bench/coin_selection.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
using node::NodeContext;
1515
using wallet::AttemptSelection;
16-
using wallet::CInputCoin;
1716
using wallet::COutput;
1817
using wallet::CWallet;
1918
using wallet::CWalletTx;
@@ -74,8 +73,6 @@ static void CoinSelection(benchmark::Bench& bench)
7473
});
7574
}
7675

77-
typedef std::set<CInputCoin> CoinSet;
78-
7976
// Copied from src/wallet/test/coinselector_tests.cpp
8077
static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>& set)
8178
{

src/wallet/coinselection.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,59 +19,6 @@ static constexpr CAmount MIN_CHANGE{COIN / 100};
1919
static const CAmount MIN_FINAL_CHANGE = MIN_CHANGE/2;
2020

2121
/** A UTXO under consideration for use in funding a new transaction. */
22-
class CInputCoin {
23-
public:
24-
CInputCoin(const CTransactionRef& tx, unsigned int i)
25-
{
26-
if (!tx)
27-
throw std::invalid_argument("tx should not be null");
28-
if (i >= tx->vout.size())
29-
throw std::out_of_range("The output index is out of range");
30-
31-
outpoint = COutPoint(tx->GetHash(), i);
32-
txout = tx->vout[i];
33-
effective_value = txout.nValue;
34-
}
35-
36-
CInputCoin(const CTransactionRef& tx, unsigned int i, int input_bytes) : CInputCoin(tx, i)
37-
{
38-
m_input_bytes = input_bytes;
39-
}
40-
41-
CInputCoin(const COutPoint& outpoint_in, const CTxOut& txout_in)
42-
{
43-
outpoint = outpoint_in;
44-
txout = txout_in;
45-
effective_value = txout.nValue;
46-
}
47-
48-
CInputCoin(const COutPoint& outpoint_in, const CTxOut& txout_in, int input_bytes) : CInputCoin(outpoint_in, txout_in)
49-
{
50-
m_input_bytes = input_bytes;
51-
}
52-
53-
COutPoint outpoint;
54-
CTxOut txout;
55-
CAmount effective_value;
56-
CAmount m_fee{0};
57-
CAmount m_long_term_fee{0};
58-
59-
/** Pre-computed estimated size of this output as a fully-signed input in a transaction. Can be -1 if it could not be calculated */
60-
int m_input_bytes{-1};
61-
62-
bool operator<(const CInputCoin& rhs) const {
63-
return outpoint < rhs.outpoint;
64-
}
65-
66-
bool operator!=(const CInputCoin& rhs) const {
67-
return outpoint != rhs.outpoint;
68-
}
69-
70-
bool operator==(const CInputCoin& rhs) const {
71-
return outpoint == rhs.outpoint;
72-
}
73-
};
74-
7522
class COutput
7623
{
7724
public:
@@ -134,11 +81,6 @@ class COutput
13481

13582
std::string ToString() const;
13683

137-
inline CInputCoin GetInputCoin() const
138-
{
139-
return CInputCoin(outpoint, txout, input_bytes);
140-
}
141-
14284
bool operator<(const COutput& rhs) const {
14385
return outpoint < rhs.outpoint;
14486
}

0 commit comments

Comments
 (0)