Skip to content

Commit

Permalink
Show chainlocked txes as fully confirmed (#2807)
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Mar 27, 2019
1 parent f87035d commit 39ba45f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactionrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 11 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "evo/providertx.h"

#include "llmq/quorums_instantsend.h"
#include "llmq/quorums_chainlocks.h"

#include <assert.h>

Expand Down Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class CMerkleTx
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);
Expand Down

0 comments on commit 39ba45f

Please sign in to comment.