aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-01-17 16:05:16 -0500
committerAndrew Chow <achow101-github@achow101.com>2022-03-23 14:32:07 -0400
commit42e974e15c6deba1d9395a4da9341c9ebec6e8e5 (patch)
treeadca0196b7fbde657e49c0e9cc26bf15b1dfe470 /src/wallet
parent14d04d5ad15ae56df56edee7ca9a202b52037889 (diff)
downloadbitcoin-42e974e15c6deba1d9395a4da9341c9ebec6e8e5.tar.xz
wallet: Remove CWallet and CWalletTx from COutput's constructor
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/spend.cpp5
-rw-r--r--src/wallet/spend.h6
-rw-r--r--src/wallet/test/coinselector_tests.cpp2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index ce6fe8e4c9..0094af7b2d 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -192,8 +192,9 @@ void AvailableCoins(const CWallet& wallet, std::vector<COutput>& vCoins, const C
bool solvable = provider ? IsSolvable(*provider, wtx.tx->vout[i].scriptPubKey) : false;
bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable));
+ int input_bytes = GetTxSpendSize(wallet, wtx, i, (coinControl && coinControl->fAllowWatchOnly));
- vCoins.emplace_back(wallet, wtx, i, nDepth, GetTxSpendSize(wallet, wtx, i, /*use_max_sig=*/ (coinControl && coinControl->fAllowWatchOnly)), spendable, solvable, safeTx, wtx.GetTxTime(), tx_from_me);
+ vCoins.emplace_back(COutPoint(wtx.GetHash(), i), wtx.tx->vout.at(i), nDepth, input_bytes, spendable, solvable, safeTx, wtx.GetTxTime(), tx_from_me);
// Checks the sum amount of all UTXO's.
if (nMinimumSumAmount != MAX_MONEY) {
@@ -284,7 +285,7 @@ std::map<CTxDestination, std::vector<COutput>> ListCoins(const CWallet& wallet)
CTxDestination address;
if (ExtractDestination(FindNonChangeParentOutput(wallet, *wtx.tx, output.n).scriptPubKey, address)) {
result[address].emplace_back(
- wallet, wtx, output.n, depth, GetTxSpendSize(wallet, wtx, output.n), /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ false, wtx.GetTxTime(), CachedTxIsFromMe(wallet, wtx, ISMINE_ALL));
+ COutPoint(wtx.GetHash(), output.n), wtx.tx->vout.at(output.n), depth, GetTxSpendSize(wallet, wtx, output.n), /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ false, wtx.GetTxTime(), CachedTxIsFromMe(wallet, wtx, ISMINE_ALL));
}
}
}
diff --git a/src/wallet/spend.h b/src/wallet/spend.h
index 141ec833ee..42f1124b7e 100644
--- a/src/wallet/spend.h
+++ b/src/wallet/spend.h
@@ -54,9 +54,9 @@ public:
/** Whether the transaction containing this output is sent from the owning wallet */
bool from_me;
- COutput(const CWallet& wallet, const CWalletTx& wtx, int iIn, int depth, int input_bytes, bool spendable, bool solvable, bool safe, int64_t time, bool from_me)
- : outpoint(COutPoint(wtx.GetHash(), iIn)),
- txout(wtx.tx->vout.at(iIn)),
+ 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),
diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp
index 393ec138c6..fb246a3377 100644
--- a/src/wallet/test/coinselector_tests.cpp
+++ b/src/wallet/test/coinselector_tests.cpp
@@ -88,7 +88,7 @@ static void add_coin(std::vector<COutput>& coins, CWallet& wallet, const CAmount
auto ret = wallet.mapWallet.emplace(std::piecewise_construct, std::forward_as_tuple(txid), std::forward_as_tuple(MakeTransactionRef(std::move(tx)), TxStateInactive{}));
assert(ret.second);
CWalletTx& wtx = (*ret.first).second;
- coins.emplace_back(wallet, wtx, nInput, nAge, GetTxSpendSize(wallet, wtx, nInput), /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ true, wtx.GetTxTime(), fIsFromMe);
+ coins.emplace_back(COutPoint(wtx.GetHash(), nInput), wtx.tx->vout.at(nInput), nAge, GetTxSpendSize(wallet, wtx, nInput), /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ true, wtx.GetTxTime(), fIsFromMe);
}
/** Check if SelectionResult a is equivalent to SelectionResult b.