coinselection: Remove CInputCoin

It is no longer needed as everything it was doing is now done by COutput
pull/24091/head
Andrew Chow 3 years ago
parent 70f31f1a81
commit f6c39c6adb

@ -13,7 +13,6 @@
using node::NodeContext;
using wallet::AttemptSelection;
using wallet::CInputCoin;
using wallet::COutput;
using wallet::CWallet;
using wallet::CWalletTx;
@ -74,8 +73,6 @@ static void CoinSelection(benchmark::Bench& bench)
});
}
typedef std::set<CInputCoin> CoinSet;
// Copied from src/wallet/test/coinselector_tests.cpp
static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>& set)
{

@ -19,59 +19,6 @@ static constexpr CAmount MIN_CHANGE{COIN / 100};
static const CAmount MIN_FINAL_CHANGE = MIN_CHANGE/2;
/** A UTXO under consideration for use in funding a new transaction. */
class CInputCoin {
public:
CInputCoin(const CTransactionRef& tx, unsigned int i)
{
if (!tx)
throw std::invalid_argument("tx should not be null");
if (i >= tx->vout.size())
throw std::out_of_range("The output index is out of range");
outpoint = COutPoint(tx->GetHash(), i);
txout = tx->vout[i];
effective_value = txout.nValue;
}
CInputCoin(const CTransactionRef& tx, unsigned int i, int input_bytes) : CInputCoin(tx, i)
{
m_input_bytes = input_bytes;
}
CInputCoin(const COutPoint& outpoint_in, const CTxOut& txout_in)
{
outpoint = outpoint_in;
txout = txout_in;
effective_value = txout.nValue;
}
CInputCoin(const COutPoint& outpoint_in, const CTxOut& txout_in, int input_bytes) : CInputCoin(outpoint_in, txout_in)
{
m_input_bytes = input_bytes;
}
COutPoint outpoint;
CTxOut txout;
CAmount effective_value;
CAmount m_fee{0};
CAmount m_long_term_fee{0};
/** Pre-computed estimated size of this output as a fully-signed input in a transaction. Can be -1 if it could not be calculated */
int m_input_bytes{-1};
bool operator<(const CInputCoin& rhs) const {
return outpoint < rhs.outpoint;
}
bool operator!=(const CInputCoin& rhs) const {
return outpoint != rhs.outpoint;
}
bool operator==(const CInputCoin& rhs) const {
return outpoint == rhs.outpoint;
}
};
class COutput
{
public:
@ -134,11 +81,6 @@ public:
std::string ToString() const;
inline CInputCoin GetInputCoin() const
{
return CInputCoin(outpoint, txout, input_bytes);
}
bool operator<(const COutput& rhs) const {
return outpoint < rhs.outpoint;
}

Loading…
Cancel
Save