15 #include "validation.h"
30 if (wtx.
tx->nLockTime < LOCKTIME_THRESHOLD)
39 return tr(
"conflicted with a transaction with %1 confirmations").arg(-nDepth);
41 return tr(
"%1/offline").arg(nDepth);
43 return tr(
"0/unconfirmed, %1").arg((wtx.
InMempool() ? tr(
"in memory pool") : tr(
"not in memory pool"))) + (wtx.
isAbandoned() ?
", "+tr(
"abandoned") :
"");
45 return tr(
"%1/unconfirmed").arg(nDepth);
47 return tr(
"%1 confirmations").arg(nDepth);
56 strHTML.reserve(4000);
57 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
62 CAmount nNet = nCredit - nDebit;
69 strHTML += tr(
", has not been successfully broadcast yet");
70 else if (nRequests > 0)
71 strHTML += tr(
", broadcast through %n node(s)",
"", nRequests);
82 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
100 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
101 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
107 strHTML +=
" (" + addressOwned +
")";
120 std::string strAddress = wtx.
mapValue[
"to"];
121 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
137 BOOST_FOREACH(
const CTxOut& txout, wtx.
tx->vout)
139 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
143 strHTML +=
"(" + tr(
"not accepted") +
")";
156 BOOST_FOREACH(
const CTxIn& txin, wtx.
tx->vin)
159 if(fAllFromMe > mine) fAllFromMe = mine;
163 BOOST_FOREACH(
const CTxOut& txout, wtx.
tx->vout)
166 if(fAllToMe > mine) fAllToMe = mine;
172 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
177 BOOST_FOREACH(
const CTxOut& txout, wtx.
tx->vout)
190 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
195 strHTML +=
" (own address)";
197 strHTML +=
" (watch-only)";
211 CAmount nValue = nCredit - nChange;
216 CAmount nTxFee = nDebit - wtx.
tx->GetValueOut();
225 BOOST_FOREACH(
const CTxIn& txin, wtx.
tx->vin)
228 BOOST_FOREACH(
const CTxOut& txout, wtx.
tx->vout)
229 if (wallet->
IsMine(txout))
244 strHTML +=
"<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxID() +
"<br>";
245 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " + QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
246 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " + QString::number(rec->
getOutputIndex()) +
"<br>";
250 if (r.first ==
"Message")
251 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
GUIUtil::HtmlEscape(r.second,
true) +
"<br>";
258 if (r.first ==
"PaymentRequest")
261 req.
parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
271 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(nCoinbaseMaturity)) +
"<br>";
279 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
280 BOOST_FOREACH(
const CTxIn& txin, wtx.
tx->vin)
283 BOOST_FOREACH(
const CTxOut& txout, wtx.
tx->vout)
287 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
290 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
293 BOOST_FOREACH(
const CTxIn& txin, wtx.
tx->vin)
300 if (prevout.
n < prev.
vout.size())
309 strHTML += QString::fromStdString(
CBitcoinAddress(address).ToString());
312 strHTML = strHTML +
" IsMine=" + (wallet->
IsMine(vout) &
ISMINE_SPENDABLE ? tr(
"true") : tr(
"false")) +
"</li>";
313 strHTML = strHTML +
" IsWatchOnly=" + (wallet->
IsMine(vout) &
ISMINE_WATCH_ONLY ? tr(
"true") : tr(
"false")) +
"</li>";
321 strHTML +=
"</font></html>";
int64_t CAmount
Amount in satoshis (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit)
base58-encoded Bitcoin addresses.
CTxDestination Get() const
int Height() const
Return the maximal height in the chain.
const Consensus::Params & GetConsensus(uint32_t nTargetHeight) const
Pruned version of CTransaction: only retains metadata and unspent transaction outputs.
std::vector< CTxOut > vout
unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are d...
bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
int GetDepthInMainChain(const CBlockIndex *&pindexRet) const
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
int GetBlocksToMaturity() const
bool IsInMainChain() const
An outpoint - a combination of a transaction hash and an index n into its vout.
An input of a transaction.
An output of a transaction.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
std::map< CTxDestination, CAddressBookData > mapAddressBook
CCriticalSection cs_wallet
A transaction with a bunch of additional info that only the owner cares about.
std::vector< std::pair< std::string, std::string > > vOrderForm
unsigned int nTimeReceived
time received by this node
bool getMerchant(X509_STORE *certStore, QString &merchant) const
bool parse(const QByteArray &data)
static X509_STORE * getCertStore()
static QString toHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
static QString FormatTxStatus(const CWalletTx &wtx)
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)
CAmount GetCredit(const isminefilter &filter) const
isminetype IsMine(const CTxIn &txin) const
CAmount GetDebit(const CTxIn &txin, const isminefilter &filter) const
Returns amount of debit if the input matches the filter, otherwise returns 0.
CAmount GetChange() const
CAmount GetDebit(const isminefilter &filter) const
filter decides which addresses will count towards the debit
CAmount GetCredit(const CTxOut &txout, const isminefilter &filter) const
int64_t GetTxTime() const
int GetRequestCount() const
isminetype IsMine(const CKeyStore &keystore, const CScript &scriptPubKey, SigVersion sigversion)
isminetype
IsMine() return codes.
QString HtmlEscape(const QString &str, bool fMultiLine)
QString dateTimeStr(const QDateTime &date)
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
uint32_t nCoinbaseMaturity
#define AssertLockHeld(cs)
int64_t GetAdjustedTime()
#define PAIRTYPE(t1, t2)
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
CCriticalSection cs_main
Global state.
bool CheckFinalTx(const CTransaction &tx, int flags)
Check if transaction will be final in the next block to be created.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).