File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2294,6 +2294,12 @@ bool CWalletTx::InMempool() const
2294
2294
}
2295
2295
2296
2296
bool CWalletTx::IsTrusted (interfaces::Chain::Lock& locked_chain) const
2297
+ {
2298
+ std::set<uint256> s;
2299
+ return IsTrusted (locked_chain, s);
2300
+ }
2301
+
2302
+ bool CWalletTx::IsTrusted (interfaces::Chain::Lock& locked_chain, std::set<uint256>& trustedParents) const
2297
2303
{
2298
2304
// Quick answer in most cases
2299
2305
if (!locked_chain.checkFinalTx (*tx)) {
@@ -2322,9 +2328,13 @@ bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
2322
2328
// Check that this specific input being spent is trusted
2323
2329
if (pwallet->IsMine (parentOut) != ISMINE_SPENDABLE)
2324
2330
return false ;
2331
+ // If we've already trusted this parent, continue
2332
+ if (trustedParents.count (parent->GetHash ()))
2333
+ continue ;
2325
2334
// Recurse to check that the parent is also trusted
2326
- if (!parent->IsTrusted (locked_chain))
2335
+ if (!parent->IsTrusted (locked_chain, trustedParents ))
2327
2336
return false ;
2337
+ trustedParents.insert (parent->GetHash ());
2328
2338
}
2329
2339
return true ;
2330
2340
}
Original file line number Diff line number Diff line change @@ -616,6 +616,7 @@ class CWalletTx
616
616
617
617
bool InMempool () const ;
618
618
bool IsTrusted (interfaces::Chain::Lock& locked_chain) const ;
619
+ bool IsTrusted (interfaces::Chain::Lock& locked_chain, std::set<uint256>& trustedParents) const ;
619
620
620
621
int64_t GetTxTime () const ;
621
622
You can’t perform that action at this time.
0 commit comments