From f6c39c6adb6cbf9c87f04d3d667701905ef5c0a0 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 17 Jan 2022 17:21:36 -0500 Subject: [PATCH] coinselection: Remove CInputCoin It is no longer needed as everything it was doing is now done by COutput --- src/bench/coin_selection.cpp | 3 -- src/wallet/coinselection.h | 58 ------------------------------------ 2 files changed, 61 deletions(-) diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index b332ef9c11a..85d8ca774aa 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -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 CoinSet; - // Copied from src/wallet/test/coinselector_tests.cpp static void add_coin(const CAmount& nValue, int nInput, std::vector& set) { diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h index 4d39be364cb..ff85dd5fe2f 100644 --- a/src/wallet/coinselection.h +++ b/src/wallet/coinselection.h @@ -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; }