23 #include <validation.h> 34 return tr(
"Open for %n more block(s)",
"", wtx.
tx->nLockTime - numBlocks);
42 return tr(
"conflicted with a transaction with %1 confirmations").arg(-nDepth);
44 return tr(
"0/unconfirmed, %1").arg((inMempool ? tr(
"in memory pool") : tr(
"not in memory pool"))) + (status.
is_abandoned ?
", "+tr(
"abandoned") :
"");
46 return tr(
"%1/unconfirmed").arg(nDepth);
48 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");
132 strHTML +=
" (" + addressOwned +
", " + tr(
"label") +
": " +
GUIUtil::HtmlEscape(name) +
")";
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)";
226 else if(toSelf & ISMINE_WATCH_ONLY)
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)
322 for (
const CTxOut& txout : wtx.
tx->vout)
326 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
329 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
332 for (
const CTxIn& txin : wtx.
tx->vin)
346 if (wallet.
getAddress(address, &name,
nullptr,
nullptr) && !name.empty())
360 strHTML +=
"</font></html>";
virtual bool getAddress(const CTxDestination &dest, std::string *name, isminetype *is_mine, std::string *purpose)=0
Look up address in wallet, return whether exists.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
virtual WalletTx getWalletTxDetails(const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
Get transaction details.
virtual isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
QString getTxHash() const
Return the unique identifier for this transaction (part)
std::vector< isminetype > txin_is_mine
std::vector< isminetype > txout_is_mine
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CTxOut out
unspent transaction output
QString dateTimeStr(const QDateTime &date)
virtual uint32_t getLogCategories()=0
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule) ...
static QString toHTML(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, int unit)
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).
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
virtual isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
int64_t CAmount
Amount in satoshis (Can be negative)
int getOutputIndex() const
Return the output index of the subtransaction.
UI model for a transaction.
virtual CAmount getCredit(const CTxOut &txout, isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
An input of a transaction.
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
Interface for accessing a wallet.
static QString FormatTxStatus(const interfaces::WalletTx &wtx, const interfaces::WalletTxStatus &status, bool inMempool, int numBlocks)
isminetype
IsMine() return codes.
An output of a transaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
virtual CAmount getDebit(const CTxIn &txin, isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
CTxDestination DecodeDestination(const std::string &str)
std::vector< std::pair< std::string, std::string > > WalletOrderForm
std::string EncodeDestination(const CTxDestination &dest)
bool GetPaymentRequestMerchant(const std::string &pr, QString &merchant)
std::map< std::string, std::string > value_map
static const unsigned int LOCKTIME_THRESHOLD
Top-level interface for a bitcoin node (bitcoind process).
Updated transaction status.
virtual bool getUnspentOutput(const COutPoint &output, Coin &coin)=0
Get unspent outputs associated with a transaction.