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;
|
return nChangeCached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CWalletTx::InMempool() const
|
||||||
|
{
|
||||||
|
LOCK(mempool.cs);
|
||||||
|
if (mempool.exists(GetHash())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CWalletTx::IsTrusted() const
|
bool CWalletTx::IsTrusted() const
|
||||||
{
|
{
|
||||||
// Quick answer in most cases
|
// Quick answer in most cases
|
||||||
@ -1456,12 +1465,8 @@ bool CWalletTx::IsTrusted() const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Don't trust unconfirmed transactions from us unless they are in the mempool.
|
// Don't trust unconfirmed transactions from us unless they are in the mempool.
|
||||||
{
|
if (!InMempool())
|
||||||
LOCK(mempool.cs);
|
|
||||||
if (!mempool.exists(GetHash())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trusted if all inputs are from us and are in the mempool:
|
// Trusted if all inputs are from us and are in the mempool:
|
||||||
BOOST_FOREACH(const CTxIn& txin, vin)
|
BOOST_FOREACH(const CTxIn& txin, vin)
|
||||||
|
@ -393,6 +393,7 @@ public:
|
|||||||
// True if only scriptSigs are different
|
// True if only scriptSigs are different
|
||||||
bool IsEquivalentTo(const CWalletTx& tx) const;
|
bool IsEquivalentTo(const CWalletTx& tx) const;
|
||||||
|
|
||||||
|
bool InMempool() const;
|
||||||
bool IsTrusted() const;
|
bool IsTrusted() const;
|
||||||
|
|
||||||
bool WriteToDisk(CWalletDB *pwalletdb);
|
bool WriteToDisk(CWalletDB *pwalletdb);
|
||||||
|
Loading…
Reference in New Issue
Block a user