QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
{
    int nDepth = GetDepthInMainChain(wtx.GetTxID());
    if ( (int64_t)wtx.nLockHeight > chainActive.Height() + 1)
    {
       return tr("Open for %n more block(s)", "", wtx.nLockHeight - chainActive.Height());
    }
    else if( (int64_t)(wtx.nLockHeight + MIN_HISTORY) < chainActive.Height() && nDepth == -1){
       return tr("Unknown");
    }
    else
    {
        if (nDepth < 0)
            return tr("conflicted");
	else if (nDepth == 0)
            return tr("unconfirmed");
        else if (nDepth < 6)
            return tr("%1/confirming").arg(nDepth);
        else
            return tr("%1 confirmations").arg(nDepth);
    }
}
Beispiel #2
0
int CMerkleTx::GetBlocksToMaturity() const
{
    if (!IsCoinBase())
        return 0;
    return std::max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain());
}