mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 03:09:37 +01:00
wallet: Remove unused WalletTXO::GetWalletTx()
This commit is contained in:
parent
531aa39036
commit
bc1c12cb29
3 changed files with 7 additions and 11 deletions
|
@ -323,7 +323,6 @@ CoinsResult AvailableCoins(const CWallet& wallet,
|
|||
// Cache for whether each tx passes the tx level checks (first bool), and whether the transaction is "safe" (second bool)
|
||||
std::unordered_map<uint256, std::pair<bool, bool>, SaltedTxidHasher> tx_safe_cache;
|
||||
for (const auto& [outpoint, txo] : wallet.GetTXOs()) {
|
||||
const CWalletTx& wtx = txo.GetWalletTx();
|
||||
const CTxOut& output = txo.GetTxOut();
|
||||
|
||||
if (tx_safe_cache.contains(outpoint.hash) && !tx_safe_cache.at(outpoint.hash).first) {
|
||||
|
@ -347,20 +346,21 @@ CoinsResult AvailableCoins(const CWallet& wallet,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (wallet.IsTxImmatureCoinBase(wtx) && !params.include_immature_coinbase)
|
||||
if (wallet.IsTXOInImmatureCoinBase(txo) && !params.include_immature_coinbase)
|
||||
continue;
|
||||
|
||||
isminetype mine = wallet.IsMine(output);
|
||||
|
||||
assert(mine != ISMINE_NO);
|
||||
|
||||
int nDepth = wallet.GetTxDepthInMainChain(wtx);
|
||||
int nDepth = wallet.GetTxStateDepthInMainChain(txo.GetState());
|
||||
if (nDepth < 0)
|
||||
continue;
|
||||
|
||||
// Perform tx level checks if we haven't already come across outputs from this tx before.
|
||||
if (!tx_safe_cache.contains(outpoint.hash)) {
|
||||
tx_safe_cache[outpoint.hash] = {false, false};
|
||||
const CWalletTx& wtx = *wallet.GetWalletTx(outpoint.hash);
|
||||
|
||||
// We should not consider coins which aren't at least in our mempool
|
||||
// It's possible for these to be conflicted via ancestors which we may never be able to detect
|
||||
|
@ -415,7 +415,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
|
|||
continue;
|
||||
}
|
||||
|
||||
bool tx_from_me = CheckIsFromMeMap(wtx.m_from_me, ISMINE_ALL);
|
||||
bool tx_from_me = CheckIsFromMeMap(txo.GetTxFromMe(), ISMINE_ALL);
|
||||
|
||||
std::unique_ptr<SigningProvider> provider = wallet.GetSolvingProvider(output.scriptPubKey);
|
||||
|
||||
|
|
|
@ -385,7 +385,6 @@ struct WalletTxOrderComparator {
|
|||
class WalletTXO
|
||||
{
|
||||
private:
|
||||
const CWalletTx& m_wtx;
|
||||
const CTxOut& m_output;
|
||||
isminetype m_ismine;
|
||||
TxState m_tx_state;
|
||||
|
@ -394,9 +393,8 @@ private:
|
|||
int64_t m_tx_time;
|
||||
|
||||
public:
|
||||
WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map<isminefilter, bool>& tx_from_me, int64_t tx_time)
|
||||
: m_wtx(wtx),
|
||||
m_output(output),
|
||||
WalletTXO(const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map<isminefilter, bool>& tx_from_me, int64_t tx_time)
|
||||
: m_output(output),
|
||||
m_ismine(ismine),
|
||||
m_tx_state(state),
|
||||
m_tx_coinbase(coinbase),
|
||||
|
@ -404,8 +402,6 @@ public:
|
|||
m_tx_time(tx_time)
|
||||
{}
|
||||
|
||||
const CWalletTx& GetWalletTx() const { return m_wtx; }
|
||||
|
||||
const CTxOut& GetTxOut() const { return m_output; }
|
||||
|
||||
isminetype GetIsMine() const { return m_ismine; }
|
||||
|
|
|
@ -4685,7 +4685,7 @@ void CWallet::RefreshSingleTxTXOs(const CWalletTx& wtx)
|
|||
it->second.SetIsMine(ismine);
|
||||
it->second.SetState(wtx.GetState());
|
||||
} else {
|
||||
auto [txo_it, _] = m_txos.emplace(outpoint, WalletTXO{wtx, txout, ismine, wtx.GetState(), wtx.IsCoinBase(), wtx.m_from_me, wtx.GetTxTime()});
|
||||
auto [txo_it, _] = m_txos.emplace(outpoint, WalletTXO{txout, ismine, wtx.GetState(), wtx.IsCoinBase(), wtx.m_from_me, wtx.GetTxTime()});
|
||||
wtx.m_txos.emplace(i, &txo_it->second);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue