23 #include <validation.h> 29 #include <QLatin1String> 44 return tr(
"conflicted with a transaction with %1 confirmations").arg(-depth);
45 }
else if (depth == 0) {
51 s = tr(
"0/unconfirmed, in memory pool");
56 s = tr(
"0/unconfirmed, not in memory pool");
62 s += QLatin1String(
", ") + tr(
"abandoned");
65 }
else if (depth < 6) {
70 return tr(
"%1/unconfirmed").arg(depth);
75 return tr(
"%1 confirmations").arg(depth);
84 if (pr.find(std::string({0x12, 0x0b}) +
"x509+sha256") != std::string::npos || pr.find(std::string({0x12, 0x09}) +
"x509+sha1") != std::string::npos) {
89 size_t cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03});
90 if (cn_pos != std::string::npos) {
91 cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03}, cn_pos + 5);
92 if (cn_pos != std::string::npos) {
94 if (pr[cn_pos] == 0x13 || pr[cn_pos] == 0x0c) {
96 int str_len = pr[cn_pos];
98 merchant = QString::fromUtf8(pr.data() + cn_pos, str_len);
117 strHTML.reserve(4000);
118 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
120 int64_t nTime = wtx.
time;
123 CAmount nNet = nCredit - nDebit;
125 strHTML +=
"<b>" + tr(
"Status") +
":</b> " +
FormatTxStatus(status, inMempool);
135 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
152 if (
wallet.getAddress(address, &
name, &ismine,
nullptr))
154 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
155 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
157 QString addressOwned = ismine ==
ISMINE_SPENDABLE ? tr(
"own address") : tr(
"watch-only");
161 strHTML +=
" (" + addressOwned +
")";
174 std::string strAddress = wtx.
value_map[
"to"];
175 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
179 dest, &
name,
nullptr,
nullptr) && !
name.empty())
193 for (
const CTxOut& txout : wtx.
tx->vout)
195 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
199 strHTML +=
"(" + tr(
"not accepted") +
")";
214 if(fAllFromMe > mine) fAllFromMe = mine;
220 if(fAllToMe > mine) fAllToMe = mine;
226 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
232 for (
const CTxOut& txout : wtx.
tx->vout)
245 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
248 address, &
name,
nullptr,
nullptr) && !
name.empty())
252 strHTML +=
" (" + tr(
"own address") +
")";
254 strHTML +=
" (" + tr(
"watch-only") +
")";
268 CAmount nValue = nCredit - nChange;
273 CAmount nTxFee = nDebit - wtx.
tx->GetValueOut();
283 for (
const CTxIn& txin : wtx.
tx->vin) {
289 for (
const CTxOut& txout : wtx.
tx->vout) {
307 strHTML +=
"<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxHash() +
"<br>";
308 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " + QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
310 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " + QString::number(rec->
getOutputIndex()) +
"<br>";
313 for (
const std::pair<std::string, std::string>& r : orderForm) {
314 if (r.first ==
"Message")
315 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
GUIUtil::HtmlEscape(r.second,
true) +
"<br>";
320 if (r.first ==
"PaymentRequest")
326 merchant += tr(
" (Certificate was not verified)");
328 if (!merchant.isNull()) {
337 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>";
345 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
346 for (
const CTxIn& txin : wtx.
tx->vin)
347 if(
wallet.txinIsMine(txin))
349 for (
const CTxOut& txout : wtx.
tx->vout)
350 if(
wallet.txoutIsMine(txout))
353 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
356 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
359 for (
const CTxIn& txin : wtx.
tx->vin)
364 if(
node.getUnspentOutput(prevout, prev))
373 if (
wallet.getAddress(address, &
name,
nullptr,
nullptr) && !
name.empty())
378 strHTML = strHTML +
" IsMine=" + (
wallet.txoutIsMine(vout) &
ISMINE_SPENDABLE ? tr(
"true") : tr(
"false")) +
"</li>";
379 strHTML = strHTML +
" IsWatchOnly=" + (
wallet.txoutIsMine(vout) &
ISMINE_WATCH_ONLY ? tr(
"true") : tr(
"false")) +
"</li>";
387 strHTML +=
"</font></html>";
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination corresponds to one with an address.
std::vector< wallet::isminetype > txin_is_mine
QString getTxHash() const
Return the unique identifier for this transaction (part)
static QString FormatTxStatus(const interfaces::WalletTxStatus &status, bool inMempool)
CTxOut out
unspent transaction output
QString dateTimeStr(const QDateTime &date)
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule) ...
QString HtmlEscape(const QString &str, bool fMultiLine)
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
int64_t CAmount
Amount in satoshis (Can be negative)
std::vector< wallet::isminetype > txout_is_mine
int getOutputIndex() const
Return the output index of the subtransaction.
UI model for a transaction.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a scriptPubKey for the destination.
An input of a transaction.
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Interface for accessing a wallet.
An output of a transaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
std::vector< std::pair< std::string, std::string > > WalletOrderForm
std::string EncodeDestination(const CTxDestination &dest)
bool GetPaymentRequestMerchant(const std::string &pr, QString &merchant)
static QString formatHtmlWithUnit(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
std::map< std::string, std::string > value_map
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
Top-level interface for a bitcoin node (bitcoind process).
Updated transaction status.
static QString toHTML(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, BitcoinUnit unit)