@@ -2302,38 +2302,29 @@ bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
23022302bool CWalletTx::IsTrusted (interfaces::Chain::Lock& locked_chain, std::set<uint256>& trusted_parents) const
23032303{
23042304 // Quick answer in most cases
2305- if (!locked_chain.checkFinalTx (*tx)) {
2306- return false ;
2307- }
2305+ if (!locked_chain.checkFinalTx (*tx)) return false ;
23082306 int nDepth = GetDepthInMainChain (locked_chain);
2309- if (nDepth >= 1 )
2310- return true ;
2311- if (nDepth < 0 )
2312- return false ;
2313- if (!pwallet->m_spend_zero_conf_change || !IsFromMe (ISMINE_ALL)) // using wtx's cached debit
2314- return false ;
2307+ if (nDepth >= 1 ) return true ;
2308+ if (nDepth < 0 ) return false ;
2309+ // using wtx's cached debit
2310+ if (!pwallet->m_spend_zero_conf_change || !IsFromMe (ISMINE_ALL)) return false ;
23152311
23162312 // Don't trust unconfirmed transactions from us unless they are in the mempool.
2317- if (!InMempool ())
2318- return false ;
2313+ if (!InMempool ()) return false ;
23192314
23202315 // Trusted if all inputs are from us and are in the mempool:
23212316 for (const CTxIn& txin : tx->vin )
23222317 {
23232318 // Transactions not sent by us: not trusted
23242319 const CWalletTx* parent = pwallet->GetWalletTx (txin.prevout .hash );
2325- if (parent == nullptr )
2326- return false ;
2320+ if (parent == nullptr ) return false ;
23272321 const CTxOut& parentOut = parent->tx ->vout [txin.prevout .n ];
23282322 // Check that this specific input being spent is trusted
2329- if (pwallet->IsMine (parentOut) != ISMINE_SPENDABLE)
2330- return false ;
2323+ if (pwallet->IsMine (parentOut) != ISMINE_SPENDABLE) return false ;
23312324 // If we've already trusted this parent, continue
2332- if (trusted_parents.count (parent->GetHash ()))
2333- continue ;
2325+ if (trusted_parents.count (parent->GetHash ())) continue ;
23342326 // Recurse to check that the parent is also trusted
2335- if (!parent->IsTrusted (locked_chain, trusted_parents))
2336- return false ;
2327+ if (!parent->IsTrusted (locked_chain, trusted_parents)) return false ;
23372328 trusted_parents.insert (parent->GetHash ());
23382329 }
23392330 return true ;
0 commit comments