Show chainlocked txes as fully confirmed (#2807)

This commit is contained in:
UdjinM6 2019-03-27 10:34:22 +03:00 committed by GitHub
parent f87035d146
commit 39ba45f3c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View File

@ -43,15 +43,20 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
QString strTxStatus;
bool fOffline = (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60) && (wtx.GetRequestCount() == 0);
bool fChainLocked = wtx.IsChainLocked();
if (fOffline) {
strTxStatus = tr("%1/offline").arg(nDepth);
} else if (nDepth == 0) {
strTxStatus = tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool"))) + (wtx.isAbandoned() ? ", "+tr("abandoned") : "");
} else if (nDepth < 6) {
} else if (!fChainLocked && nDepth < 6) {
strTxStatus = tr("%1/unconfirmed").arg(nDepth);
} else {
strTxStatus = tr("%1 confirmations").arg(nDepth);
if (fChainLocked) {
strTxStatus += " (" + tr("locked via LLMQ based ChainLocks") + ")";
return strTxStatus;
}
}
if (llmq::quorumInstantSendManager->IsLocked(wtx.GetHash())) {

View File

@ -329,7 +329,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
if (wtx.isAbandoned())
status.status = TransactionStatus::Abandoned;
}
else if (status.depth < RecommendedNumConfirmations)
else if (!wtx.IsChainLocked() && status.depth < RecommendedNumConfirmations)
{
status.status = TransactionStatus::Confirming;
}

View File

@ -37,6 +37,7 @@
#include "evo/providertx.h"
#include "llmq/quorums_instantsend.h"
#include "llmq/quorums_chainlocks.h"
#include <assert.h>
@ -5404,6 +5405,16 @@ bool CMerkleTx::IsLockedByInstantSend() const
return instantsend.IsLockedInstantSendTransaction(GetHash()) || llmq::quorumInstantSendManager->IsLocked(GetHash());
}
bool CMerkleTx::IsChainLocked() const
{
AssertLockHeld(cs_main);
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && mi->second != nullptr) {
return llmq::chainLocksHandler->HasChainLock(mi->second->nHeight, hashBlock);
}
return false;
}
int CMerkleTx::GetBlocksToMaturity() const
{
if (!IsCoinBase())

View File

@ -271,6 +271,7 @@ public:
int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; }
bool IsLockedByInstantSend() const;
bool IsChainLocked() const;
int GetBlocksToMaturity() const;
/** Pass this transaction to the mempool. Fails if absolute fee exceeds absurd fee. */
bool AcceptToMemoryPool(const CAmount& nAbsurdFee, CValidationState& state);