| 24 | #include <string> |
| 25 | |
| 26 | QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime) |
| 27 | { |
| 28 | if (!status.is_final) |
| 29 | { |
| 30 | if (wtx.tx->nLockTime < LOCKTIME_THRESHOLD) |
| 31 | return tr("Open for %n more block(s)", "", wtx.tx->nLockTime - numBlocks); |
| 32 | else |
| 33 | return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.tx->nLockTime)); |
| 34 | } |
| 35 | else |
| 36 | { |
| 37 | int nDepth = status.depth_in_main_chain; |
| 38 | if (nDepth < 0) |
| 39 | return tr("conflicted with a transaction with %1 confirmations").arg(-nDepth); |
| 40 | else if (nDepth == 0) |
| 41 | return tr("0/unconfirmed, %1").arg((inMempool ? tr("in memory pool") : tr("not in memory pool"))) + (status.is_abandoned ? ", "+tr("abandoned") : ""); |
| 42 | else if (nDepth < 6) |
| 43 | return tr("%1/unconfirmed").arg(nDepth); |
| 44 | else |
| 45 | return tr("%1 confirmations").arg(nDepth); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit) |
| 50 | { |
nothing calls this directly
no test coverage detected