aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2015-11-30 16:15:15 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2015-12-02 08:38:31 +0100
commita3c3ddbd7ba68b9a9871b8574e05cc146a69f811 (patch)
treee97f46bdf1161d13f5d1743c62baad816e39c131 /src/wallet
parent4077ad20d03f0ef61d48ef34b3107661b0ff8ffe (diff)
[Qt] add InMempool() info to transaction details
Diffstat (limited to 'src/wallet')
-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 30b9869be0..f49950da6b 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1359,6 +1359,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
@@ -1373,12 +1382,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 859788893c..7354ff19c7 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -384,6 +384,7 @@ public:
// True if only scriptSigs are different
bool IsEquivalentTo(const CWalletTx& tx) const;
+ bool InMempool() const;
bool IsTrusted() const;
bool WriteToDisk(CWalletDB *pwalletdb);