6 #include <config/bitcoin-config.h> 24 #include <validation.h> 33 bool inMempool,
int numBlocks) {
36 return tr(
"Open for %n more block(s)",
"",
37 wtx.
tx->nLockTime - numBlocks);
39 return tr(
"Open until %1")
45 return tr(
"conflicted with a transaction with %1 confirmations")
47 }
else if (nDepth == 0) {
48 return tr(
"0/unconfirmed, %1")
49 .arg((inMempool ? tr(
"in memory pool")
50 : tr(
"not in memory pool"))) +
52 }
else if (nDepth < 6) {
53 return tr(
"%1/unconfirmed").arg(nDepth);
55 return tr(
"%1 confirmations").arg(nDepth);
65 if (pr.find(std::string({0x12, 0x0b}) +
"x509+sha256") !=
67 pr.find(std::string({0x12, 0x09}) +
"x509+sha1") != std::string::npos) {
73 size_t cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03});
74 if (cn_pos != std::string::npos) {
75 cn_pos = pr.find({0x06, 0x03, 0x55, 0x04, 0x03}, cn_pos + 5);
76 if (cn_pos != std::string::npos) {
78 if (pr[cn_pos] == 0x13 || pr[cn_pos] == 0x0c) {
80 int str_len = pr[cn_pos];
82 merchant = QString::fromUtf8(pr.data() + cn_pos, str_len);
100 rec->
txid, status, orderForm, inMempool, numBlocks);
104 strHTML.reserve(4000);
105 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
107 int64_t nTime = wtx.
time;
110 Amount nNet = nCredit - nDebit;
112 strHTML +=
"<b>" + tr(
"Status") +
":</b> " +
116 strHTML +=
"<b>" + tr(
"Date") +
":</b> " +
123 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
126 strHTML +=
"<b>" + tr(
"From") +
":</b> " +
137 if (wallet.
getAddress(address, &name, &ismine,
140 "<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
141 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
147 strHTML +=
" (" + addressOwned +
", " + tr(
"label") +
150 strHTML +=
" (" + addressOwned +
")";
163 std::string strAddress = wtx.
value_map[
"to"];
164 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
184 for (
const CTxOut &txout : wtx.
tx->vout) {
187 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
191 tr(
"matures in %n more block(s)",
"",
195 strHTML +=
"(" + tr(
"not accepted") +
")";
202 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
207 if (fAllFromMe > mine) {
214 if (fAllToMe > mine) {
222 "<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
229 for (
const CTxOut &txout : wtx.
tx->vout) {
241 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
252 strHTML +=
" (own address)";
253 }
else if (toSelf & ISMINE_WATCH_ONLY) {
254 strHTML +=
" (watch-only)";
261 "<b>" + tr(
"Debit") +
":</b> " +
266 "<b>" + tr(
"Credit") +
":</b> " +
275 Amount nValue = nCredit - nChange;
276 strHTML +=
"<b>" + tr(
"Total debit") +
":</b> " +
279 strHTML +=
"<b>" + tr(
"Total credit") +
":</b> " +
284 Amount nTxFee = nDebit - wtx.
tx->GetValueOut();
286 strHTML +=
"<b>" + tr(
"Transaction fee") +
":</b> " +
295 for (
const CTxIn &txin : wtx.
tx->vin) {
297 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
304 for (
const CTxOut &txout : wtx.
tx->vout) {
306 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
315 strHTML +=
"<b>" + tr(
"Net amount") +
":</b> " +
322 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
326 strHTML +=
"<br><b>" + tr(
"Comment") +
":</b><br>" +
330 "<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxID() +
"<br>";
331 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " +
332 QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
333 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " +
337 for (
const std::pair<std::string, std::string> &r : orderForm) {
338 if (r.first ==
"Message") {
339 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
346 if (r.first ==
"PaymentRequest") {
351 QByteArray::fromRawData(r.second.data(), r.second.size()));
352 if (!req.
getMerchant(PaymentServer::getCertStore(), merchant)) {
359 merchant += tr(
" (Certificate was not verified)");
362 if (!merchant.isNull()) {
363 strHTML +=
"<b>" + tr(
"Merchant") +
":</b> " +
373 tr(
"Generated coins must mature %1 blocks before they can be " 374 "spent. When you generated this block, it was broadcast to the " 375 "network to be added to the block chain. If it fails to get " 376 "into the chain, its state will change to \"not accepted\" and " 377 "it won't be spendable. This may occasionally happen if another " 378 "node generates a block within a few seconds of yours.")
379 .arg(QString::number(numBlocksToMaturity)) +
387 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
388 for (
const CTxIn &txin : wtx.
tx->vin) {
390 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
396 for (
const CTxOut &txout : wtx.
tx->vout) {
398 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
405 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
408 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
411 for (
const CTxIn &txin : wtx.
tx->vin) {
427 strHTML += QString::fromStdString(
430 strHTML = strHTML +
" " + tr(
"Amount") +
"=" +
432 strHTML = strHTML +
" IsMine=" +
437 strHTML = strHTML +
" IsWatchOnly=" +
448 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.
static constexpr Amount zero()
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
virtual isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
std::vector< isminetype > txin_is_mine
std::vector< isminetype > txout_is_mine
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
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)...
static QString toHTML(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, int unit)
QString HtmlEscape(const QString &str, bool fMultiLine)
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
virtual Amount getDebit(const CTxIn &txin, isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
virtual isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
int getOutputIndex() const
Return the output index of the subtransaction.
UI model for a transaction.
bool getMerchant(X509_STORE *certStore, QString &merchant) const
An input of a transaction.
QString getTxID() const
Return the unique identifier for this transaction (part)
Interface for accessing a wallet.
virtual Amount getCredit(const CTxOut &txout, isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
static QString FormatTxStatus(const interfaces::WalletTx &wtx, const interfaces::WalletTxStatus &status, bool inMempool, int numBlocks)
isminetype
IsMine() return codes.
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
An output of a transaction.
virtual WalletTx getWalletTxDetails(const TxId &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
Get transaction details.
An outpoint - a combination of a transaction hash and an index n into its vout.
bool parse(const QByteArray &data)
static QString formatHtmlWithUnit(int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit)
virtual const CChainParams & getChainParams()=0
Get chainparams.
std::vector< std::pair< std::string, std::string > > WalletOrderForm
std::string EncodeCashAddr(const CTxDestination &dst, const CChainParams ¶ms)
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.
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
virtual bool getUnspentOutput(const COutPoint &output, Coin &coin)=0
Get unspent outputs associated with a transaction.