update variable naming conventions for IsTrusted

This commit is contained in:
Jeremy Rubin 2019-09-06 09:15:49 -07:00
parent 5ffe0d1449
commit b49dcbedf7
2 changed files with 11 additions and 11 deletions

View file

@ -2299,7 +2299,7 @@ bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
return IsTrusted(locked_chain, s); return IsTrusted(locked_chain, s);
} }
bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain, std::set<uint256>& trustedParents) const bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain, std::set<uint256>& trusted_parents) const
{ {
// Quick answer in most cases // Quick answer in most cases
if (!locked_chain.checkFinalTx(*tx)) { if (!locked_chain.checkFinalTx(*tx)) {
@ -2329,12 +2329,12 @@ bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain, std::set<uint25
if (pwallet->IsMine(parentOut) != ISMINE_SPENDABLE) if (pwallet->IsMine(parentOut) != ISMINE_SPENDABLE)
return false; return false;
// If we've already trusted this parent, continue // If we've already trusted this parent, continue
if (trustedParents.count(parent->GetHash())) if (trusted_parents.count(parent->GetHash()))
continue; continue;
// Recurse to check that the parent is also trusted // Recurse to check that the parent is also trusted
if (!parent->IsTrusted(locked_chain, trustedParents)) if (!parent->IsTrusted(locked_chain, trusted_parents))
return false; return false;
trustedParents.insert(parent->GetHash()); trusted_parents.insert(parent->GetHash());
} }
return true; return true;
} }
@ -2420,11 +2420,11 @@ CWallet::Balance CWallet::GetBalance(const int min_depth, bool avoid_reuse) cons
{ {
auto locked_chain = chain().lock(); auto locked_chain = chain().lock();
LOCK(cs_wallet); LOCK(cs_wallet);
std::set<uint256> trustedParents; std::set<uint256> trusted_parents;
for (const auto& entry : mapWallet) for (const auto& entry : mapWallet)
{ {
const CWalletTx& wtx = entry.second; const CWalletTx& wtx = entry.second;
const bool is_trusted{wtx.IsTrusted(*locked_chain, trustedParents)}; const bool is_trusted{wtx.IsTrusted(*locked_chain, trusted_parents)};
const int tx_depth{wtx.GetDepthInMainChain(*locked_chain)}; const int tx_depth{wtx.GetDepthInMainChain(*locked_chain)};
const CAmount tx_credit_mine{wtx.GetAvailableCredit(*locked_chain, /* fUseCache */ true, ISMINE_SPENDABLE | reuse_filter)}; const CAmount tx_credit_mine{wtx.GetAvailableCredit(*locked_chain, /* fUseCache */ true, ISMINE_SPENDABLE | reuse_filter)};
const CAmount tx_credit_watchonly{wtx.GetAvailableCredit(*locked_chain, /* fUseCache */ true, ISMINE_WATCH_ONLY | reuse_filter)}; const CAmount tx_credit_watchonly{wtx.GetAvailableCredit(*locked_chain, /* fUseCache */ true, ISMINE_WATCH_ONLY | reuse_filter)};
@ -2471,7 +2471,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
const int min_depth = {coinControl ? coinControl->m_min_depth : DEFAULT_MIN_DEPTH}; const int min_depth = {coinControl ? coinControl->m_min_depth : DEFAULT_MIN_DEPTH};
const int max_depth = {coinControl ? coinControl->m_max_depth : DEFAULT_MAX_DEPTH}; const int max_depth = {coinControl ? coinControl->m_max_depth : DEFAULT_MAX_DEPTH};
std::set<uint256> trustedParents; std::set<uint256> trusted_parents;
for (const auto& entry : mapWallet) for (const auto& entry : mapWallet)
{ {
const uint256& wtxid = entry.first; const uint256& wtxid = entry.first;
@ -2493,7 +2493,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
if (nDepth == 0 && !wtx.InMempool()) if (nDepth == 0 && !wtx.InMempool())
continue; continue;
bool safeTx = wtx.IsTrusted(locked_chain, trustedParents); bool safeTx = wtx.IsTrusted(locked_chain, trusted_parents);
// We should not consider coins from transactions that are replacing // We should not consider coins from transactions that are replacing
// other transactions. // other transactions.
@ -3778,12 +3778,12 @@ std::map<CTxDestination, CAmount> CWallet::GetAddressBalances(interfaces::Chain:
{ {
LOCK(cs_wallet); LOCK(cs_wallet);
std::set<uint256> trustedParents; std::set<uint256> trusted_parents;
for (const auto& walletEntry : mapWallet) for (const auto& walletEntry : mapWallet)
{ {
const CWalletTx& wtx = walletEntry.second; const CWalletTx& wtx = walletEntry.second;
if (!wtx.IsTrusted(locked_chain, trustedParents)) if (!wtx.IsTrusted(locked_chain, trusted_parents))
continue; continue;
if (wtx.IsImmatureCoinBase(locked_chain)) if (wtx.IsImmatureCoinBase(locked_chain))

View file

@ -616,7 +616,7 @@ public:
bool InMempool() const; bool InMempool() const;
bool IsTrusted(interfaces::Chain::Lock& locked_chain) const; bool IsTrusted(interfaces::Chain::Lock& locked_chain) const;
bool IsTrusted(interfaces::Chain::Lock& locked_chain, std::set<uint256>& trustedParents) const; bool IsTrusted(interfaces::Chain::Lock& locked_chain, std::set<uint256>& trusted_parents) const;
int64_t GetTxTime() const; int64_t GetTxTime() const;