 |
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
22 #include <validation.h>
28 #include <QLatin1String>
40 return tr(
"conflicted with a transaction with %1 confirmations").arg(-nDepth);
41 }
else if (nDepth == 0) {
42 const QString abandoned{status.
is_abandoned ? QLatin1String(
", ") + tr(
"abandoned") : QString()};
43 return tr(
"0/unconfirmed, %1").arg(inMempool ? tr(
"in memory pool") : tr(
"not in memory pool")) + abandoned;
44 }
else if (nDepth < 6) {
45 return tr(
"%1/unconfirmed").arg(nDepth);
47 return tr(
"%1 confirmations").arg(nDepth);
57 if (pr.find(std::string({0x12, 0x0b}) +
"x509+sha256") != std::string::npos || 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);
90 strHTML.reserve(4000);
91 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
93 int64_t nTime = wtx.
time;
96 CAmount nNet = nCredit - nDebit;
98 strHTML +=
"<b>" + tr(
"Status") +
":</b> " +
FormatTxStatus(wtx, status, inMempool, numBlocks);
108 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
125 if (
wallet.getAddress(address, &
name, &ismine,
nullptr))
127 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
128 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
130 QString addressOwned = ismine ==
ISMINE_SPENDABLE ? tr(
"own address") : tr(
"watch-only");
134 strHTML +=
" (" + addressOwned +
")";
147 std::string strAddress = wtx.
value_map[
"to"];
148 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
152 dest, &
name,
nullptr,
nullptr) && !
name.empty())
166 for (
const CTxOut& txout : wtx.
tx->vout)
168 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
172 strHTML +=
"(" + tr(
"not accepted") +
")";
187 if(fAllFromMe > mine) fAllFromMe = mine;
193 if(fAllToMe > mine) fAllToMe = mine;
199 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
205 for (
const CTxOut& txout : wtx.
tx->vout)
218 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
221 address, &
name,
nullptr,
nullptr) && !
name.empty())
225 strHTML +=
" (own address)";
227 strHTML +=
" (watch-only)";
241 CAmount nValue = nCredit - nChange;
246 CAmount nTxFee = nDebit - wtx.
tx->GetValueOut();
256 for (
const CTxIn& txin : wtx.
tx->vin) {
262 for (
const CTxOut& txout : wtx.
tx->vout) {
280 strHTML +=
"<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxHash() +
"<br>";
281 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " + QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
283 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " + QString::number(rec->
getOutputIndex()) +
"<br>";
286 for (
const std::pair<std::string, std::string>& r : orderForm) {
287 if (r.first ==
"Message")
288 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
GUIUtil::HtmlEscape(r.second,
true) +
"<br>";
293 if (r.first ==
"PaymentRequest")
299 merchant += tr(
" (Certificate was not verified)");
301 if (!merchant.isNull()) {
310 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>";
318 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
319 for (
const CTxIn& txin : wtx.
tx->vin)
320 if(
wallet.txinIsMine(txin))
322 for (
const CTxOut& txout : wtx.
tx->vout)
323 if(
wallet.txoutIsMine(txout))
326 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
329 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
332 for (
const CTxIn& txin : wtx.
tx->vin)
337 if(
node.getUnspentOutput(prevout, prev))
346 if (
wallet.getAddress(address, &
name,
nullptr,
nullptr) && !
name.empty())
351 strHTML = strHTML +
" IsMine=" + (
wallet.txoutIsMine(vout) &
ISMINE_SPENDABLE ? tr(
"true") : tr(
"false")) +
"</li>";
352 strHTML = strHTML +
" IsWatchOnly=" + (
wallet.txoutIsMine(vout) &
ISMINE_WATCH_ONLY ? tr(
"true") : tr(
"false")) +
"</li>";
360 strHTML +=
"</font></html>";
An input of a transaction.
QString getTxHash() const
Return the unique identifier for this transaction (part)
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
bool GetPaymentRequestMerchant(const std::string &pr, QString &merchant)
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
static QString toHTML(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, int unit)
UI model for a transaction.
std::vector< wallet::isminetype > txout_is_mine
CTxOut out
unspent transaction output
std::map< std::string, std::string > value_map
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
An output of a transaction.
int64_t CAmount
Amount in satoshis (Can be negative)
static QString FormatTxStatus(const interfaces::WalletTx &wtx, const interfaces::WalletTxStatus &status, bool inMempool, int numBlocks)
std::vector< wallet::isminetype > txin_is_mine
Updated transaction status.
Interface for accessing a wallet.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
std::vector< std::pair< std::string, std::string > > WalletOrderForm
Top-level interface for a bitcoin node (bitcoind process).
QString HtmlEscape(const QString &str, bool fMultiLine)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
int getOutputIndex() const
Return the output index of the subtransaction
QString dateTimeStr(const QDateTime &date)
An outpoint - a combination of a transaction hash and an index n into its vout.
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
std::string EncodeDestination(const CTxDestination &dest)