aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-01-13 18:08:03 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-01-13 18:08:05 +0100
commit3d5cf698d60eaa22ede6937207a205aede4212ff (patch)
tree70e3337f962474bf770e845366a20f9f62fe42e4
parent2a3161bf8bd458ef44a53af37899fad684b257d6 (diff)
parenta06a8b488896dd83a320fff10d48300ca01e9ba4 (diff)
Merge pull request #7333v0.12.0rc1
a06a8b4 add InMempool() function (Jonas Schnelli)
-rw-r--r--src/wallet/wallet.cpp17
-rw-r--r--src/wallet/wallet.h1
2 files changed, 12 insertions, 6 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 2930131508..cbc71aa16b 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -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())) {
- return false;
- }
- }
+ if (!InMempool())
+ return false;
// Trusted if all inputs are from us and are in the mempool:
BOOST_FOREACH(const CTxIn& txin, vin)
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index df417fef42..f7e57e2058 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -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);