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
1442
1442
return nChangeCached;
1443
1443
}
1444
1444
1445
+ bool CWalletTx::InMempool () const
1446
+ {
1447
+ LOCK (mempool.cs );
1448
+ if (mempool.exists (GetHash ())) {
1449
+ return true ;
1450
+ }
1451
+ return false ;
1452
+ }
1453
+
1445
1454
bool CWalletTx::IsTrusted () const
1446
1455
{
1447
1456
// Quick answer in most cases
@@ -1456,12 +1465,8 @@ bool CWalletTx::IsTrusted() const
1456
1465
return false ;
1457
1466
1458
1467
// 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 ;
1465
1470
1466
1471
// Trusted if all inputs are from us and are in the mempool:
1467
1472
BOOST_FOREACH (const CTxIn& txin, vin)
Original file line number Diff line number Diff line change @@ -393,6 +393,7 @@ class CWalletTx : public CMerkleTx
393
393
// True if only scriptSigs are different
394
394
bool IsEquivalentTo (const CWalletTx& tx) const ;
395
395
396
+ bool InMempool () const ;
396
397
bool IsTrusted () const ;
397
398
398
399
bool WriteToDisk (CWalletDB *pwalletdb);
You can’t perform that action at this time.
0 commit comments