Merge pull request #7333

a06a8b4 add InMempool() function (Jonas Schnelli)
This commit is contained in:
Wladimir J. van der Laan 2016-01-13 18:08:03 +01:00
commit 3d5cf698d6
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
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);