6#include <config/bitcoin-config.h>
24#include <validation.h>
33 bool inMempool,
int numBlocks) {
36 return tr(
"conflicted with a transaction with %1 confirmations")
38 }
else if (nDepth == 0) {
39 return tr(
"0/unconfirmed, %1")
40 .arg((inMempool ? tr(
"in memory pool")
41 : tr(
"not in memory pool"))) +
43 }
else if (nDepth < 6) {
44 return tr(
"%1/unconfirmed").arg(nDepth);
46 return tr(
"%1 confirmations").arg(nDepth);
55 if (pr.find(std::string({0x12, 0x0b}) +
"x509+sha256") !=
57 pr.find(std::string({0x12, 0x09}) +
"x509+sha1") != std::string::npos) {
63 size_t cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03});
64 if (cn_pos != std::string::npos) {
65 cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03}, cn_pos + 5);
66 if (cn_pos != std::string::npos) {
68 if (pr[cn_pos] == 0x13 || pr[cn_pos] == 0x0c) {
70 int str_len = pr[cn_pos];
72 merchant = QString::fromUtf8(pr.data() + cn_pos, str_len);
90 rec->
txid, status, orderForm, inMempool, numBlocks);
94 strHTML.reserve(4000);
95 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
97 int64_t nTime = wtx.
time;
100 Amount nNet = nCredit - nDebit;
102 strHTML +=
"<b>" + tr(
"Status") +
":</b> " +
106 strHTML +=
"<b>" + tr(
"Date") +
":</b> " +
113 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
116 strHTML +=
"<b>" + tr(
"From") +
":</b> " +
127 if (
wallet.getAddress(address, &
name, &ismine,
130 "<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
131 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
137 strHTML +=
" (" + addressOwned +
", " + tr(
"label") +
140 strHTML +=
" (" + addressOwned +
")";
153 std::string strAddress = wtx.
value_map[
"to"];
154 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
174 for (
const CTxOut &txout : wtx.
tx->vout) {
177 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
181 tr(
"matures in %n more block(s)",
"",
185 strHTML +=
"(" + tr(
"not accepted") +
")";
192 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
197 if (fAllFromMe > mine) {
204 if (fAllToMe > mine) {
212 "<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
219 for (
const CTxOut &txout : wtx.
tx->vout) {
231 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
242 strHTML +=
" (own address)";
244 strHTML +=
" (watch-only)";
251 "<b>" + tr(
"Debit") +
":</b> " +
256 "<b>" + tr(
"Credit") +
":</b> " +
265 Amount nValue = nCredit - nChange;
266 strHTML +=
"<b>" + tr(
"Total debit") +
":</b> " +
269 strHTML +=
"<b>" + tr(
"Total credit") +
":</b> " +
274 Amount nTxFee = nDebit - wtx.
tx->GetValueOut();
276 strHTML +=
"<b>" + tr(
"Transaction fee") +
":</b> " +
285 for (
const CTxIn &txin : wtx.
tx->vin) {
287 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
294 for (
const CTxOut &txout : wtx.
tx->vout) {
296 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
305 strHTML +=
"<b>" + tr(
"Net amount") +
":</b> " +
312 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
316 strHTML +=
"<br><b>" + tr(
"Comment") +
":</b><br>" +
320 "<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxID() +
"<br>";
321 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " +
322 QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
323 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " +
327 for (
const std::pair<std::string, std::string> &r : orderForm) {
328 if (r.first ==
"Message") {
329 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
336 if (r.first ==
"PaymentRequest") {
341 QByteArray::fromRawData(r.second.data(), r.second.size()));
342 if (!req.
getMerchant(PaymentServer::getCertStore(), merchant)) {
349 merchant += tr(
" (Certificate was not verified)");
352 if (!merchant.isNull()) {
353 strHTML +=
"<b>" + tr(
"Merchant") +
":</b> " +
363 tr(
"Generated coins must mature %1 blocks before they can be "
364 "spent. When you generated this block, it was broadcast to the "
365 "network to be added to the block chain. If it fails to get "
366 "into the chain, its state will change to \"not accepted\" and "
367 "it won't be spendable. This may occasionally happen if another "
368 "node generates a block within a few seconds of yours.")
369 .arg(QString::number(numBlocksToMaturity)) +
377 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
378 for (
const CTxIn &txin : wtx.
tx->vin) {
379 if (
wallet.txinIsMine(txin)) {
380 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
386 for (
const CTxOut &txout : wtx.
tx->vout) {
387 if (
wallet.txoutIsMine(txout)) {
388 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
395 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
398 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
401 for (
const CTxIn &txin : wtx.
tx->vin) {
402 COutPoint prevout = txin.prevout;
404 if (
auto prev{
node.getUnspentOutput(prevout)}) {
406 const CTxOut &vout = prev->GetTxOut();
416 strHTML += QString::fromStdString(
419 strHTML = strHTML +
" " + tr(
"Amount") +
"=" +
421 strHTML = strHTML +
" IsMine=" +
426 strHTML = strHTML +
" IsWatchOnly=" +
437 strHTML +=
"</font></html>";
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.
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
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)