add InMempool() function

This commit is contained in:
Jonas Schnelli 2015-11-30 16:15:15 +01:00 committed by Alex Morcos
parent 2a3161bf8b
commit a06a8b4888
2 changed files with 12 additions and 6 deletions

View File

@ -1442,6 +1442,15 @@ CAmount CWalletTx::GetChange() const
return nChangeCached;
}
bool CWalletTx::InMempool() const
{
LOCK(mempool.cs);
if (mempool.exists(GetHash())) {
return true;
}
return false;
}
bool CWalletTx::IsTrusted() const
{
// Quick answer in most cases
@ -1456,12 +1465,8 @@ bool CWalletTx::IsTrusted() const
return false;
// Don't trust unconfirmed transactions from us unless they are in the mempool.
{
LOCK(mempool.cs);
if (!mempool.exists(GetHash())) {
if (!InMempool())
return false;
}
}
// Trusted if all inputs are from us and are in the mempool:
BOOST_FOREACH(const CTxIn& txin, vin)

View File

@ -393,6 +393,7 @@ public:
// True if only scriptSigs are different
bool IsEquivalentTo(const CWalletTx& tx) const;
bool InMempool() const;
bool IsTrusted() const;
bool WriteToDisk(CWalletDB *pwalletdb);