Merge pull request #7333
a06a8b4
add InMempool() function (Jonas Schnelli)
This commit is contained in:
commit
3d5cf698d6
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user