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);
60 strHTML.reserve(4000);
61 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
66 CAmount nNet = nCredit - nDebit;
73 strHTML += tr(
", has not been successfully broadcast yet");
74 else if (nRequests > 0)
75 strHTML += tr(
", broadcast through %n node(s)",
"", nRequests);
86 strHTML +=
"<b>" + tr(
"Source") +
":</b> " + tr(
"Generated") +
"<br>";
103 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
104 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
110 strHTML +=
" (" + addressOwned +
")";
123 std::string strAddress = wtx.
mapValue[
"to"];
124 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
140 for (
const CTxOut& txout : wtx.
tx->vout)
142 strHTML +=
"<b>" + tr(
"Credit") +
":</b> ";
146 strHTML +=
"(" + tr(
"not accepted") +
")";
159 for (
const CTxIn& txin : wtx.
tx->vin)
162 if(fAllFromMe > mine) fAllFromMe = mine;
166 for (
const CTxOut& txout : wtx.
tx->vout)
169 if(fAllToMe > mine) fAllToMe = mine;
175 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"watch-only") +
"<br>";
180 for (
const CTxOut& txout : wtx.
tx->vout)
193 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
198 strHTML +=
" (own address)";
199 else if(toSelf & ISMINE_WATCH_ONLY)
200 strHTML +=
" (watch-only)";
214 CAmount nValue = nCredit - nChange;
219 CAmount nTxFee = nDebit - wtx.
tx->GetValueOut();
228 for (
const CTxIn& txin : wtx.
tx->vin)
231 for (
const CTxOut& txout : wtx.
tx->vout)
232 if (wallet->
IsMine(txout))
247 strHTML +=
"<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxID() +
"<br>";
248 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " + QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
249 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " + QString::number(rec->
getOutputIndex()) +
"<br>";
252 for (
const std::pair<std::string, std::string>& r : wtx.
vOrderForm)
253 if (r.first ==
"Message")
254 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
GUIUtil::HtmlEscape(r.second,
true) +
"<br>";
259 for (
const std::pair<std::string, std::string>& r : wtx.
vOrderForm)
261 if (r.first ==
"PaymentRequest")
264 req.
parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
273 quint32 numBlocksToMaturity = COINBASE_MATURITY + 1;
274 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>";
285 strHTML +=
"</font></html>";
294 strHTML.reserve(4000);
295 strHTML +=
"<html><font face='verdana, arial, helvetica, sans-serif'>";
301 else if (currentActiveAssetCache && currentActiveAssetCache->GetAssetMetaDataIfExists(rec->
assetName, asset))
309 CAmount nNet = nCredit - nDebit;
319 strHTML += tr(
", has not been successfully broadcast yet");
320 else if (nRequests > 0)
321 strHTML += tr(
", broadcast through %n node(s)",
"", nRequests);
345 strHTML +=
"<b>" + tr(
"From") +
":</b> " + tr(
"unknown") +
"<br>";
346 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
352 strHTML +=
" (" + addressOwned +
")";
365 std::string strAddress = wtx.
mapValue[
"to"];
366 strHTML +=
"<b>" + tr(
"To") +
":</b> ";
396 strHTML +=
"<b>" + tr(
"Transaction ID") +
":</b> " + rec->
getTxID() +
"<br>";
397 strHTML +=
"<b>" + tr(
"Transaction total size") +
":</b> " + QString::number(wtx.
tx->GetTotalSize()) +
" bytes<br>";
398 strHTML +=
"<b>" + tr(
"Output index") +
":</b> " + QString::number(rec->
getOutputIndex()) +
"<br>";
401 for (
const std::pair<std::string, std::string>& r : wtx.
vOrderForm)
402 if (r.first ==
"Message")
403 strHTML +=
"<br><b>" + tr(
"Message") +
":</b><br>" +
GUIUtil::HtmlEscape(r.second,
true) +
"<br>";
408 for (
const std::pair<std::string, std::string>& r : wtx.
vOrderForm)
410 if (r.first ==
"PaymentRequest")
413 req.
parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
422 quint32 numBlocksToMaturity = COINBASE_MATURITY + 1;
423 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>";
434 strHTML +=
"</font></html>";
440 strHTML +=
"<hr><br>" + tr(
"Debug information") +
"<br><br>";
441 for (
const CTxIn& txin : wtx.
tx->vin)
442 if (wallet->
IsMine(txin)) {
446 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
449 strHTML +=
"<b>" + tr(
"Debit") +
":</b> " +
453 for (
const CTxOut& txout : wtx.
tx->vout)
454 if (wallet->
IsMine(txout)) {
458 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
461 strHTML +=
"<b>" + tr(
"Credit") +
":</b> " +
465 strHTML +=
"<br><b>" + tr(
"Transaction") +
":</b><br>";
468 strHTML +=
"<br><b>" + tr(
"Inputs") +
":</b>";
471 for (
const CTxIn& txin : wtx.
tx->vin)
489 strHTML = strHTML +
" IsMine=" + (wallet->
IsMine(vout) &
ISMINE_SPENDABLE ? tr(
"true") : tr(
"false")) +
"</li>";
490 strHTML = strHTML +
" IsWatchOnly=" + (wallet->
IsMine(vout) &
ISMINE_WATCH_ONLY ? tr(
"true") : tr(
"false")) +
"</li>";
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
std::map< CTxDestination, CAddressBookData > mapAddressBook
CCriticalSection cs_wallet
static void CreateDebugString(QString &strHTML, CWallet *wallet, CWalletTx &wtx, int unit)
CAmount GetDebit(const isminefilter &filter) const
filter decides which addresses will count towards the debit
int Height() const
Return the maximal height in the chain.
CCriticalSection cs_main
Global state.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CTxOut out
unspent transaction output
CTxDestination DecodeDestination(const std::string &str)
QString dateTimeStr(const QDateTime &date)
isminetype IsMine(const CKeyStore &keystore, const CScript &scriptPubKey, SigVersion sigversion)
QString HtmlEscape(const QString &str, bool fMultiLine)
std::atomic< uint32_t > logCategories
mapValue_t mapValue
Key/value map with information about the transaction.
bool GetAssetData(const CScript &script, CAssetOutputEntry &data)
int64_t CAmount
Amount in corbies (Can be negative)
#define AssertLockHeld(cs)
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
int getOutputIndex() const
Return the output index of the subtransaction.
UI model for a transaction.
bool CheckFinalTx(const CTransaction &tx, int flags)
Transaction validation functions.
bool getMerchant(X509_STORE *certStore, QString &merchant) const
CAssetsCache * GetCurrentAssetCache()
isminetype
IsMine() return codes.
An input of a transaction.
QString getTxID() const
Return the unique identifier for this transaction (part)
int GetBlocksToMaturity() const
static QString toAssetHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
An output of a transaction.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
static X509_STORE * getCertStore()
An outpoint - a combination of a transaction hash and an index n into its vout.
bool parse(const QByteArray &data)
A transaction with a bunch of additional info that only the owner cares about.
bool IsInMainChain() const
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
std::string EncodeDestination(const CTxDestination &dest)
CAmount GetDebit(const CTxIn &txin, const isminefilter &filter) const
Returns amount of debit if the input matches the filter, otherwise returns 0.
CAmount GetCredit(const isminefilter &filter) const
int64_t GetTxTime() const
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit)
int64_t GetAdjustedTime()
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
static QString FormatTxStatus(const CWalletTx &wtx)
unsigned int nTimeReceived
time received by this node
CAmount GetCredit(const CTxOut &txout, const isminefilter &filter) const
static QString formatWithCustomName(QString customName, const CAmount &amount, int unit=MAX_ASSET_UNITS, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with custom name)
isminetype IsMine(const CTxIn &txin) const
static QString toHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
int GetDepthInMainChain(const CBlockIndex *&pindexRet) const
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
CAmount GetChange() const
int GetRequestCount() const
bool IsAssetNameAnOwner(const std::string &name)
Check if an asset is an owner.
std::vector< std::pair< std::string, std::string > > vOrderForm
bool IsAssetScript(int &nType, bool &fIsOwner, int &nStartingIndex) const