6#include <config/bitcoin-config.h>
23#include <validation.h>
32 bool inMempool,
int numBlocks) {
35 return tr(
"conflicted with a transaction with %1 confirmations")
37 }
else if (nDepth == 0) {
38 return tr(
"0/unconfirmed, %1")
39 .arg((inMempool ? tr(
"in memory pool")
40 : tr(
"not in memory pool"))) +
42 }
else if (nDepth < 6) {
43 return tr(
"%1/unconfirmed").arg(nDepth);
45 return tr(
"%1 confirmations").arg(nDepth);
54 if (pr.find(std::string({0x12, 0x0b}) +
"x509+sha256") !=
56 pr.find(std::string({0x12, 0x09}) +
"x509+sha1") != std::string::npos) {
62 size_t cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03});
63 if (cn_pos != std::string::npos) {
64 cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03}, cn_pos + 5);
65 if (cn_pos != std::string::npos) {
67 if (pr[cn_pos] == 0x13 || pr[cn_pos] == 0x0c) {
69 int str_len = pr[cn_pos];
71 merchant = QString::fromUtf8(pr.data() + cn_pos, str_len);
89 rec->
txid, status, orderForm, inMempool, numBlocks);
93 strHTML.reserve(4000);
94 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
96 int64_t nTime = wtx.
time;
99 Amount nNet = nCredit - nDebit;
101 strHTML +=
"<b>" + tr(
"Status") +
":</b> " +
105 strHTML +=
"<b>" + tr(
"Date") +
":</b> " +
112 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
115 strHTML +=
"<b>" + tr(
"From") +
":</b> " +
126 if (
wallet.getAddress(address, &
name, &ismine,
129 "<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
130 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
136 strHTML +=
" (" + addressOwned +
", " + tr(
"label") +
139 strHTML +=
" (" + addressOwned +
")";
152 std::string strAddress = wtx.
value_map[
"to"];
153 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
173 for (
const CTxOut &txout : wtx.
tx->vout) {
176 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
180 tr(
"matures in %n more block(s)",
"",
184 strHTML +=
"(" + tr(
"not accepted") +
")";
191 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
196 if (fAllFromMe > mine) {
203 if (fAllToMe > mine) {
211 "<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
218 for (
const CTxOut &txout : wtx.
tx->vout) {
230 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
241 strHTML +=
" (own address)";
243 strHTML +=
" (watch-only)";
250 "<b>" + tr(
"Debit") +
":</b> " +
255 "<b>" + tr(
"Credit") +
":</b> " +
264 Amount nValue = nCredit - nChange;
265 strHTML +=
"<b>" + tr(
"Total debit") +
":</b> " +
268 strHTML +=
"<b>" + tr(
"Total credit") +
":</b> " +
273 Amount nTxFee = nDebit - wtx.
tx->GetValueOut();
275 strHTML +=
"<b>" + tr(
"Transaction fee") +
":</b> " +
284 for (
const CTxIn &txin : wtx.
tx->vin) {
286 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
293 for (
const CTxOut &txout : wtx.
tx->vout) {
295 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
304 strHTML +=
"<b>" + tr(
"Net amount") +
":</b> " +
311 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
315 strHTML +=
"<br><b>" + tr(
"Comment") +
":</b><br>" +
319 "<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxID() +
"<br>";
320 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " +
321 QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
322 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " +
326 for (
const std::pair<std::string, std::string> &r : orderForm) {
327 if (r.first ==
"Message") {
328 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
335 if (r.first ==
"PaymentRequest") {
340 QByteArray::fromRawData(r.second.data(), r.second.size()));
341 if (!req.
getMerchant(PaymentServer::getCertStore(), merchant)) {
348 merchant += tr(
" (Certificate was not verified)");
351 if (!merchant.isNull()) {
352 strHTML +=
"<b>" + tr(
"Merchant") +
":</b> " +
362 tr(
"Generated coins must mature %1 blocks before they can be "
363 "spent. When you generated this block, it was broadcast to the "
364 "network to be added to the block chain. If it fails to get "
365 "into the chain, its state will change to \"not accepted\" and "
366 "it won't be spendable. This may occasionally happen if another "
367 "node generates a block within a few seconds of yours.")
368 .arg(QString::number(numBlocksToMaturity)) +
376 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
377 for (
const CTxIn &txin : wtx.
tx->vin) {
378 if (
wallet.txinIsMine(txin)) {
379 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
385 for (
const CTxOut &txout : wtx.
tx->vout) {
386 if (
wallet.txoutIsMine(txout)) {
387 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
394 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
397 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
400 for (
const CTxIn &txin : wtx.
tx->vin) {
401 COutPoint prevout = txin.prevout;
404 if (
node.getUnspentOutput(prevout, prev)) {
416 strHTML += QString::fromStdString(
419 strHTML = strHTML +
" " + tr(
"Amount") +
"=" +
421 strHTML = strHTML +
" IsMine=" +
426 strHTML = strHTML +
" IsWatchOnly=" +
437 strHTML +=
"</font></html>";
std::string EncodeCashAddr(const CTxDestination &dst, const CChainParams ¶ms)
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
static QString formatHtmlWithUnit(int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
An output of a transaction.
bool getMerchant(X509_STORE *certStore, QString &merchant) const
bool parse(const QByteArray &data)
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 getTxID() 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.
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
QString HtmlEscape(const QString &str, bool fMultiLine)
QString dateTimeStr(const QDateTime &date)
std::vector< std::pair< std::string, std::string > > WalletOrderForm
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 > CTxDestination
A txout script template with a specific destination.
static constexpr Amount zero() noexcept
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)