Merge bitcoin/bitcoin#24666: refactor: Fix coinselection.h include, Make COutput a struct

fab287cedd Clarify that COutput is a struct, not a class (MarcoFalke)
fa61cdf464 wallet: Fix coinselection include (MarcoFalke)

Pull request description:

  * Fix include (see commit message)
  * `{}`-init, see https://github.com/bitcoin/bitcoin/pull/24091#discussion_r831193284
  * `struct`, see https://github.com/bitcoin/bitcoin/pull/24091#discussion_r831192702

ACKs for top commit:
  theStack:
    Code-review ACK fab287cedd

Tree-SHA512: dd2cfb9c06a92295dbd8fbb6d56afcf00ebda2a0440e301d392cd183d1b9cd87626311d539e302a9e6c6521d69d6183c74a51934e3fc16e64a5dcaba60c7e3ce
This commit is contained in:
fanquake 2022-03-25 15:25:14 +00:00
commit 6b1f93700c
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 15 additions and 17 deletions

View file

@ -16,10 +16,11 @@
#include <qt/platformstyle.h>
#include <qt/walletmodel.h>
#include <wallet/coincontrol.h>
#include <interfaces/node.h>
#include <key_io.h>
#include <policy/policy.h>
#include <wallet/coincontrol.h>
#include <wallet/coinselection.h>
#include <wallet/wallet.h>
#include <QApplication>

View file

@ -19,9 +19,7 @@ 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 COutput
{
public:
struct COutput {
/** The outpoint identifying this UTXO */
COutPoint outpoint;
@ -67,21 +65,22 @@ public:
CAmount long_term_fee{0};
COutput(const COutPoint& outpoint, const CTxOut& txout, int depth, int input_bytes, bool spendable, bool solvable, bool safe, int64_t time, bool from_me)
: outpoint(outpoint),
txout(txout),
depth(depth),
input_bytes(input_bytes),
spendable(spendable),
solvable(solvable),
safe(safe),
time(time),
from_me(from_me),
effective_value(txout.nValue)
: outpoint{outpoint},
txout{txout},
depth{depth},
input_bytes{input_bytes},
spendable{spendable},
solvable{solvable},
safe{safe},
time{time},
from_me{from_me},
effective_value{txout.nValue}
{}
std::string ToString() const;
bool operator<(const COutput& rhs) const {
bool operator<(const COutput& rhs) const
{
return outpoint < rhs.outpoint;
}
};

View file

@ -20,7 +20,6 @@
#include <util/system.h>
#include <util/ui_change_type.h>
#include <validationinterface.h>
#include <wallet/coinselection.h>
#include <wallet/crypter.h>
#include <wallet/scriptpubkeyman.h>
#include <wallet/transaction.h>
@ -112,7 +111,6 @@ constexpr CAmount HIGH_MAX_TX_FEE{100 * HIGH_TX_FEE_PER_KB};
static constexpr size_t DUMMY_NESTED_P2WPKH_INPUT_SIZE = 91;
class CCoinControl;
class COutput;
class CWalletTx;
class ReserveDestination;