23#include <validation.h>
29#include <QLatin1String>
36 return tr(
"Open for %n more block(s)",
"", wtx.
tx->nLockTime - numBlocks);
44 return tr(
"conflicted with a transaction with %1 confirmations").arg(-nDepth);
45 }
else if (nDepth == 0) {
46 const QString abandoned{status.
is_abandoned ? QLatin1String(
", ") + tr(
"abandoned") : QString()};
47 return tr(
"0/unconfirmed, %1").arg(inMempool ? tr(
"in memory pool") : tr(
"not in memory pool")) + abandoned;
48 }
else if (nDepth < 6) {
49 return tr(
"%1/unconfirmed").arg(nDepth);
51 return tr(
"%1 confirmations").arg(nDepth);
61 if (pr.find(std::string({0x12, 0x0b}) +
"x509+sha256") != std::string::npos || pr.find(std::string({0x12, 0x09}) +
"x509+sha1") != std::string::npos) {
66 size_t cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03});
67 if (cn_pos != std::string::npos) {
68 cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03}, cn_pos + 5);
69 if (cn_pos != std::string::npos) {
71 if (pr[cn_pos] == 0x13 || pr[cn_pos] == 0x0c) {
73 int str_len = pr[cn_pos];
75 merchant = QString::fromUtf8(pr.data() + cn_pos, str_len);
94 strHTML.reserve(4000);
95 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
97 int64_t nTime = wtx.
time;
100 CAmount nNet = nCredit - nDebit;
102 strHTML +=
"<b>" + tr(
"Status") +
":</b> " +
FormatTxStatus(wtx, status, inMempool, numBlocks);
112 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
129 if (
wallet.getAddress(address, &
name, &ismine,
nullptr))
131 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
132 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
134 QString addressOwned = ismine ==
ISMINE_SPENDABLE ? tr(
"own address") : tr(
"watch-only");
138 strHTML +=
" (" + addressOwned +
")";
151 std::string strAddress = wtx.
value_map[
"to"];
152 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
156 dest, &
name,
nullptr,
nullptr) && !
name.empty())
170 for (
const CTxOut& txout : wtx.
tx->vout)
172 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
176 strHTML +=
"(" + tr(
"not accepted") +
")";
191 if(fAllFromMe > mine) fAllFromMe = mine;
197 if(fAllToMe > mine) fAllToMe = mine;
203 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
209 for (
const CTxOut& txout : wtx.
tx->vout)
222 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
225 address, &
name,
nullptr,
nullptr) && !
name.empty())
229 strHTML +=
" (own address)";
231 strHTML +=
" (watch-only)";
245 CAmount nValue = nCredit - nChange;
250 CAmount nTxFee = nDebit - wtx.
tx->GetValueOut();
260 for (
const CTxIn& txin : wtx.
tx->vin) {
266 for (
const CTxOut& txout : wtx.
tx->vout) {
284 strHTML +=
"<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxHash() +
"<br>";
285 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " + QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
287 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " + QString::number(rec->
getOutputIndex()) +
"<br>";
290 for (
const std::pair<std::string, std::string>& r : orderForm) {
291 if (r.first ==
"Message")
292 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
GUIUtil::HtmlEscape(r.second,
true) +
"<br>";
297 if (r.first ==
"PaymentRequest")
303 merchant += tr(
" (Certificate was not verified)");
305 if (!merchant.isNull()) {
314 strHTML +=
"<br>" + tr(
"Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to \"not accepted\" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.").arg(QString::number(numBlocksToMaturity)) +
"<br>";
322 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
323 for (
const CTxIn& txin : wtx.
tx->vin)
324 if(
wallet.txinIsMine(txin))
326 for (
const CTxOut& txout : wtx.
tx->vout)
327 if(
wallet.txoutIsMine(txout))
330 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
333 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
336 for (
const CTxIn& txin : wtx.
tx->vin)
341 if(
node.getUnspentOutput(prevout, prev))
350 if (
wallet.getAddress(address, &
name,
nullptr,
nullptr) && !
name.empty())
355 strHTML = strHTML +
" IsMine=" + (
wallet.txoutIsMine(vout) &
ISMINE_SPENDABLE ? tr(
"true") : tr(
"false")) +
"</li>";
356 strHTML = strHTML +
" IsWatchOnly=" + (
wallet.txoutIsMine(vout) &
ISMINE_WATCH_ONLY ? tr(
"true") : tr(
"false")) +
"</li>";
364 strHTML +=
"</font></html>";
int64_t CAmount
Amount in satoshis (Can be negative)
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
An outpoint - a combination of a transaction hash and an index n into its vout.
An input of a transaction.
An output of a transaction.
CTxOut out
unspent transaction output
static QString toHTML(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, int unit)
static QString FormatTxStatus(const interfaces::WalletTx &wtx, const interfaces::WalletTxStatus &status, bool inMempool, int numBlocks)
UI model for a transaction.
int getOutputIndex() const
Return the output index of the subtransaction
QString getTxHash() const
Return the unique identifier for this transaction (part)
Top-level interface for a bitcoin node (bitcoind process).
Interface for accessing a wallet.
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
std::string EncodeDestination(const CTxDestination &dest)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg)
QString HtmlEscape(const QString &str, bool fMultiLine)
QString dateTimeStr(const QDateTime &date)
std::vector< std::pair< std::string, std::string > > WalletOrderForm
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
static const unsigned int LOCKTIME_THRESHOLD
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
std::vector< isminetype > txout_is_mine
std::map< std::string, std::string > value_map
std::vector< isminetype > txin_is_mine
Updated transaction status.
bool GetPaymentRequestMerchant(const std::string &pr, QString &merchant)