File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1442,6 +1442,15 @@ CAmount CWalletTx::GetChange() const
14421442 return nChangeCached;
14431443}
14441444
1445+ bool CWalletTx::InMempool () const
1446+ {
1447+ LOCK (mempool.cs );
1448+ if (mempool.exists (GetHash ())) {
1449+ return true ;
1450+ }
1451+ return false ;
1452+ }
1453+
14451454bool CWalletTx::IsTrusted () const
14461455{
14471456 // Quick answer in most cases
@@ -1456,12 +1465,8 @@ bool CWalletTx::IsTrusted() const
14561465 return false ;
14571466
14581467 // Don't trust unconfirmed transactions from us unless they are in the mempool.
1459- {
1460- LOCK (mempool.cs );
1461- if (!mempool.exists (GetHash ())) {
1462- return false ;
1463- }
1464- }
1468+ if (!InMempool ())
1469+ return false ;
14651470
14661471 // Trusted if all inputs are from us and are in the mempool:
14671472 BOOST_FOREACH (const CTxIn& txin, vin)
Original file line number Diff line number Diff line change @@ -393,6 +393,7 @@ class CWalletTx : public CMerkleTx
393393 // True if only scriptSigs are different
394394 bool IsEquivalentTo (const CWalletTx& tx) const ;
395395
396+ bool InMempool () const ;
396397 bool IsTrusted () const ;
397398
398399 bool WriteToDisk (CWalletDB *pwalletdb);
You can’t perform that action at this time.
0 commit comments