Merge pull request #7154
a3c3ddb
[Qt] add InMempool() info to transaction details (Jonas Schnelli)
This commit is contained in:
commit
00b4b8d1c4
3 changed files with 15 additions and 7 deletions
|
@ -35,9 +35,11 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
|
||||||
{
|
{
|
||||||
int nDepth = wtx.GetDepthInMainChain();
|
int nDepth = wtx.GetDepthInMainChain();
|
||||||
if (nDepth < 0)
|
if (nDepth < 0)
|
||||||
return tr("conflicted");
|
return tr("conflicted with a transaction with %1 confirmations").arg(-nDepth);
|
||||||
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
|
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
|
||||||
return tr("%1/offline").arg(nDepth);
|
return tr("%1/offline").arg(nDepth);
|
||||||
|
else if (nDepth == 0)
|
||||||
|
return tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool")));
|
||||||
else if (nDepth < 6)
|
else if (nDepth < 6)
|
||||||
return tr("%1/unconfirmed").arg(nDepth);
|
return tr("%1/unconfirmed").arg(nDepth);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1359,6 +1359,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
|
||||||
|
@ -1373,12 +1382,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)
|
||||||
|
|
|
@ -384,6 +384,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 a new issue