@@ -2302,38 +2302,29 @@ bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
2302
2302
bool CWalletTx::IsTrusted (interfaces::Chain::Lock& locked_chain, std::set<uint256>& trusted_parents) const
2303
2303
{
2304
2304
// Quick answer in most cases
2305
- if (!locked_chain.checkFinalTx (*tx)) {
2306
- return false ;
2307
- }
2305
+ if (!locked_chain.checkFinalTx (*tx)) return false ;
2308
2306
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 ;
2315
2311
2316
2312
// Don't trust unconfirmed transactions from us unless they are in the mempool.
2317
- if (!InMempool ())
2318
- return false ;
2313
+ if (!InMempool ()) return false ;
2319
2314
2320
2315
// Trusted if all inputs are from us and are in the mempool:
2321
2316
for (const CTxIn& txin : tx->vin )
2322
2317
{
2323
2318
// Transactions not sent by us: not trusted
2324
2319
const CWalletTx* parent = pwallet->GetWalletTx (txin.prevout .hash );
2325
- if (parent == nullptr )
2326
- return false ;
2320
+ if (parent == nullptr ) return false ;
2327
2321
const CTxOut& parentOut = parent->tx ->vout [txin.prevout .n ];
2328
2322
// 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 ;
2331
2324
// 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 ;
2334
2326
// 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 ;
2337
2328
trusted_parents.insert (parent->GetHash ());
2338
2329
}
2339
2330
return true ;
0 commit comments