Raven Core  3.0.0
P2P Digital Currency
transactiondesc.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include "transactiondesc.h"
7 
8 #include "ravenunits.h"
9 #include "guiutil.h"
10 #include "paymentserver.h"
11 #include "transactionrecord.h"
12 
13 #include "base58.h"
14 #include "consensus/consensus.h"
15 #include "validation.h"
16 #include "script/script.h"
17 #include "timedata.h"
18 #include "util.h"
19 #include "wallet/db.h"
20 #include "wallet/wallet.h"
21 
22 #include <stdint.h>
23 #include <string>
24 
26 {
28  if (!CheckFinalTx(wtx))
29  {
30  if (wtx.tx->nLockTime < LOCKTIME_THRESHOLD)
31  return tr("Open for %n more block(s)", "", wtx.tx->nLockTime - chainActive.Height());
32  else
33  return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.tx->nLockTime));
34  }
35  else
36  {
37  int nDepth = wtx.GetDepthInMainChain();
38  if (nDepth < 0)
39  return tr("conflicted with a transaction with %1 confirmations").arg(-nDepth);
40  else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
41  return tr("%1/offline").arg(nDepth);
42  else if (nDepth == 0)
43  return tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool"))) + (wtx.isAbandoned() ? ", "+tr("abandoned") : "");
44  else if (nDepth < 6)
45  return tr("%1/unconfirmed").arg(nDepth);
46  else
47  return tr("%1 confirmations").arg(nDepth);
48  }
49 }
50 
51 QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
52 {
53  QString strHTML;
54 
55  if (rec->assetName != "RVN") {
56  return toAssetHTML(wallet, wtx, rec, unit);
57  }
58 
59  LOCK2(cs_main, wallet->cs_wallet);
60  strHTML.reserve(4000);
61  strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
62 
63  int64_t nTime = wtx.GetTxTime();
64  CAmount nCredit = wtx.GetCredit(ISMINE_ALL);
65  CAmount nDebit = wtx.GetDebit(ISMINE_ALL);
66  CAmount nNet = nCredit - nDebit;
67 
68  strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
69  int nRequests = wtx.GetRequestCount();
70  if (nRequests != -1)
71  {
72  if (nRequests == 0)
73  strHTML += tr(", has not been successfully broadcast yet");
74  else if (nRequests > 0)
75  strHTML += tr(", broadcast through %n node(s)", "", nRequests);
76  }
77  strHTML += "<br>";
78 
79  strHTML += "<b>" + tr("Date") + ":</b> " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "<br>";
80 
81  //
82  // From
83  //
84  if (wtx.IsCoinBase())
85  {
86  strHTML += "<b>" + tr("Source") + ":</b> " + tr("Generated") + "<br>";
87  }
88  else if (wtx.mapValue.count("from") && !wtx.mapValue["from"].empty())
89  {
90  // Online transaction
91  strHTML += "<b>" + tr("From") + ":</b> " + GUIUtil::HtmlEscape(wtx.mapValue["from"]) + "<br>";
92  }
93  else
94  {
95  // Offline transaction
96  if (nNet > 0)
97  {
98  // Credit
100  if (IsValidDestination(address)) {
101  if (wallet->mapAddressBook.count(address))
102  {
103  strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
104  strHTML += "<b>" + tr("To") + ":</b> ";
105  strHTML += GUIUtil::HtmlEscape(rec->address);
106  QString addressOwned = (::IsMine(*wallet, address) == ISMINE_SPENDABLE) ? tr("own address") : tr("watch-only");
107  if (!wallet->mapAddressBook[address].name.empty())
108  strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
109  else
110  strHTML += " (" + addressOwned + ")";
111  strHTML += "<br>";
112  }
113  }
114  }
115  }
116 
117  //
118  // To
119  //
120  if (wtx.mapValue.count("to") && !wtx.mapValue["to"].empty())
121  {
122  // Online transaction
123  std::string strAddress = wtx.mapValue["to"];
124  strHTML += "<b>" + tr("To") + ":</b> ";
125  CTxDestination dest = DecodeDestination(strAddress);
126  if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].name.empty())
127  strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest].name) + " ";
128  strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
129  }
130 
131  //
132  // Amount
133  //
134  if (wtx.IsCoinBase() && nCredit == 0)
135  {
136  //
137  // Coinbase
138  //
139  CAmount nUnmatured = 0;
140  for (const CTxOut& txout : wtx.tx->vout)
141  nUnmatured += wallet->GetCredit(txout, ISMINE_ALL);
142  strHTML += "<b>" + tr("Credit") + ":</b> ";
143  if (wtx.IsInMainChain())
144  strHTML += RavenUnits::formatHtmlWithUnit(unit, nUnmatured)+ " (" + tr("matures in %n more block(s)", "", wtx.GetBlocksToMaturity()) + ")";
145  else
146  strHTML += "(" + tr("not accepted") + ")";
147  strHTML += "<br>";
148  }
149  else if (nNet > 0)
150  {
151  //
152  // Credit
153  //
154  strHTML += "<b>" + tr("Credit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, nNet) + "<br>";
155  }
156  else
157  {
158  isminetype fAllFromMe = ISMINE_SPENDABLE;
159  for (const CTxIn& txin : wtx.tx->vin)
160  {
161  isminetype mine = wallet->IsMine(txin);
162  if(fAllFromMe > mine) fAllFromMe = mine;
163  }
164 
165  isminetype fAllToMe = ISMINE_SPENDABLE;
166  for (const CTxOut& txout : wtx.tx->vout)
167  {
168  isminetype mine = wallet->IsMine(txout);
169  if(fAllToMe > mine) fAllToMe = mine;
170  }
171 
172  if (fAllFromMe)
173  {
174  if(fAllFromMe & ISMINE_WATCH_ONLY)
175  strHTML += "<b>" + tr("From") + ":</b> " + tr("watch-only") + "<br>";
176 
177  //
178  // Debit
179  //
180  for (const CTxOut& txout : wtx.tx->vout)
181  {
182  // Ignore change
183  isminetype toSelf = wallet->IsMine(txout);
184  if ((toSelf == ISMINE_SPENDABLE) && (fAllFromMe == ISMINE_SPENDABLE))
185  continue;
186 
187  if (!wtx.mapValue.count("to") || wtx.mapValue["to"].empty())
188  {
189  // Offline transaction
190  CTxDestination address;
191  if (ExtractDestination(txout.scriptPubKey, address))
192  {
193  strHTML += "<b>" + tr("To") + ":</b> ";
194  if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
195  strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
196  strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
197  if(toSelf == ISMINE_SPENDABLE)
198  strHTML += " (own address)";
199  else if(toSelf & ISMINE_WATCH_ONLY)
200  strHTML += " (watch-only)";
201  strHTML += "<br>";
202  }
203  }
204 
205  strHTML += "<b>" + tr("Debit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, -txout.nValue) + "<br>";
206  if(toSelf)
207  strHTML += "<b>" + tr("Credit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, txout.nValue) + "<br>";
208  }
209 
210  if (fAllToMe)
211  {
212  // Payment to self
213  CAmount nChange = wtx.GetChange();
214  CAmount nValue = nCredit - nChange;
215  strHTML += "<b>" + tr("Total debit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, -nValue) + "<br>";
216  strHTML += "<b>" + tr("Total credit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, nValue) + "<br>";
217  }
218 
219  CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
220  if (nTxFee > 0)
221  strHTML += "<b>" + tr("Transaction fee") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, -nTxFee) + "<br>";
222  }
223  else
224  {
225  //
226  // Mixed debit transaction
227  //
228  for (const CTxIn& txin : wtx.tx->vin)
229  if (wallet->IsMine(txin))
230  strHTML += "<b>" + tr("Debit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, -wallet->GetDebit(txin, ISMINE_ALL)) + "<br>";
231  for (const CTxOut& txout : wtx.tx->vout)
232  if (wallet->IsMine(txout))
233  strHTML += "<b>" + tr("Credit") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, wallet->GetCredit(txout, ISMINE_ALL)) + "<br>";
234  }
235  }
236 
237  strHTML += "<b>" + tr("Net amount") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, nNet, true) + "<br>";
238 
239  //
240  // Message
241  //
242  if (wtx.mapValue.count("message") && !wtx.mapValue["message"].empty())
243  strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["message"], true) + "<br>";
244  if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
245  strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
246 
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>";
250 
251  // Message from normal raven:URI (raven:123...?message=example)
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>";
255 
256  //
257  // PaymentRequest info:
258  //
259  for (const std::pair<std::string, std::string>& r : wtx.vOrderForm)
260  {
261  if (r.first == "PaymentRequest")
262  {
263  PaymentRequestPlus req;
264  req.parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
265  QString merchant;
266  if (req.getMerchant(PaymentServer::getCertStore(), merchant))
267  strHTML += "<b>" + tr("Merchant") + ":</b> " + GUIUtil::HtmlEscape(merchant) + "<br>";
268  }
269  }
270 
271  if (wtx.IsCoinBase())
272  {
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>";
275  }
276 
277  //
278  // Debug view
279  //
280  if (logCategories != BCLog::NONE)
281  {
282  CreateDebugString(strHTML, wallet, wtx, unit);
283  }
284 
285  strHTML += "</font></html>";
286  return strHTML;
287 }
288 
289 QString TransactionDesc::toAssetHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
290 {
291  QString strHTML;
292 
293  LOCK2(cs_main, wallet->cs_wallet);
294  strHTML.reserve(4000);
295  strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
296 
297  CNewAsset asset;
298  auto currentActiveAssetCache = GetCurrentAssetCache();
299  if (IsAssetNameAnOwner(rec->assetName))
300  rec->units = OWNER_UNITS;
301  else if (currentActiveAssetCache && currentActiveAssetCache->GetAssetMetaDataIfExists(rec->assetName, asset))
302  rec->units = asset.units;
303  else
304  rec->units = MAX_ASSET_UNITS;
305 
306  int64_t nTime = wtx.GetTxTime();
307  CAmount nCredit = wtx.GetCredit(ISMINE_ALL);
308  CAmount nDebit = wtx.GetDebit(ISMINE_ALL);
309  CAmount nNet = nCredit - nDebit;
310 
311  CAmount nAssetsRec = rec->credit;
312 
313  // Status
314  strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
315  int nRequests = wtx.GetRequestCount();
316  if (nRequests != -1)
317  {
318  if (nRequests == 0)
319  strHTML += tr(", has not been successfully broadcast yet");
320  else if (nRequests > 0)
321  strHTML += tr(", broadcast through %n node(s)", "", nRequests);
322  }
323  strHTML += "<br>";
324 
325  strHTML += "<b>" + tr("Date") + ":</b> " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "<br>";
326 
327  //
328  // From
329  //
330  if (wtx.mapValue.count("from") && !wtx.mapValue["from"].empty())
331  {
332  // Online transaction
333  strHTML += "<b>" + tr("From") + ":</b> " + GUIUtil::HtmlEscape(wtx.mapValue["from"]) + "<br>";
334  }
335  else
336  {
337  // Offline transaction
338  if (nAssetsRec > 0)
339  {
340  // Credit
341  CTxDestination address = DecodeDestination(rec->address);
342  if (IsValidDestination(address)) {
343  if (wallet->mapAddressBook.count(address))
344  {
345  strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
346  strHTML += "<b>" + tr("To") + ":</b> ";
347  strHTML += GUIUtil::HtmlEscape(rec->address);
348  QString addressOwned = (::IsMine(*wallet, address) == ISMINE_SPENDABLE) ? tr("own address") : tr("watch-only");
349  if (!wallet->mapAddressBook[address].name.empty())
350  strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
351  else
352  strHTML += " (" + addressOwned + ")";
353  strHTML += "<br>";
354  }
355  }
356  }
357  }
358 
359  //
360  // To
361  //
362  if (wtx.mapValue.count("to") && !wtx.mapValue["to"].empty())
363  {
364  // Online transaction
365  std::string strAddress = wtx.mapValue["to"];
366  strHTML += "<b>" + tr("To") + ":</b> ";
367  CTxDestination dest = DecodeDestination(strAddress);
368  if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].name.empty())
369  strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest].name) + " ";
370  strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
371  }
372 
373  //
374  // Amount
375  //
376  if (nAssetsRec > 0)
377  {
378  //
379  // Credit
380  //
381  strHTML += "<b>" + tr("Credit") + ":</b> " + RavenUnits::formatWithCustomName(QString::fromStdString(rec->assetName), nAssetsRec, rec->units) + "<br>";
382  } else {
383  strHTML += "<b>" + tr("Debit") + ":</b> " + RavenUnits::formatWithCustomName(QString::fromStdString(rec->assetName), nAssetsRec, rec->units, true) + "<br>";
384  }
385 
386  strHTML += "<b>" + tr("Net RVN amount") + ":</b> " + RavenUnits::formatHtmlWithUnit(unit, nNet, true) + "<br>";
387 
388  //
389  // Message
390  //
391  if (wtx.mapValue.count("message") && !wtx.mapValue["message"].empty())
392  strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["message"], true) + "<br>";
393  if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
394  strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
395 
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>";
399 
400  // Message from normal raven:URI (raven:123...?message=example)
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>";
404 
405  //
406  // PaymentRequest info:
407  //
408  for (const std::pair<std::string, std::string>& r : wtx.vOrderForm)
409  {
410  if (r.first == "PaymentRequest")
411  {
412  PaymentRequestPlus req;
413  req.parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
414  QString merchant;
415  if (req.getMerchant(PaymentServer::getCertStore(), merchant))
416  strHTML += "<b>" + tr("Merchant") + ":</b> " + GUIUtil::HtmlEscape(merchant) + "<br>";
417  }
418  }
419 
420  if (wtx.IsCoinBase())
421  {
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>";
424  }
425 
426  //
427  // Debug view
428  //
429  if (logCategories != BCLog::NONE)
430  {
431  CreateDebugString(strHTML, wallet, wtx, unit);
432  }
433 
434  strHTML += "</font></html>";
435  return strHTML;
436 }
437 
438 void TransactionDesc::CreateDebugString(QString& strHTML, CWallet *wallet, CWalletTx &wtx, int unit)
439 {
440  strHTML += "<hr><br>" + tr("Debug information") + "<br><br>";
441  for (const CTxIn& txin : wtx.tx->vin)
442  if (wallet->IsMine(txin)) {
443  CAssetOutputEntry assetData;
444  CAmount debit = wallet->GetDebit(txin, ISMINE_ALL, assetData);
445  if (assetData.nAmount > 0) {
446  strHTML += "<b>" + tr("Debit") + ":</b> " +
447  RavenUnits::formatWithCustomName(QString::fromStdString(assetData.assetName), -assetData.nAmount) + "<br>";
448  }
449  strHTML += "<b>" + tr("Debit") + ":</b> " +
450  RavenUnits::formatHtmlWithUnit(unit, -debit) + "<br>";
451  }
452 
453  for (const CTxOut& txout : wtx.tx->vout)
454  if (wallet->IsMine(txout)) {
455  if (txout.scriptPubKey.IsAssetScript()) {
456  CAssetOutputEntry assetData;
457  GetAssetData(txout.scriptPubKey, assetData);
458  strHTML += "<b>" + tr("Credit") + ":</b> " +
459  RavenUnits::formatWithCustomName(QString::fromStdString(assetData.assetName), assetData.nAmount) + "<br>";
460  } else
461  strHTML += "<b>" + tr("Credit") + ":</b> " +
462  RavenUnits::formatHtmlWithUnit(unit, wallet->GetCredit(txout, ISMINE_ALL)) + "<br>";
463  }
464 
465  strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
466  strHTML += GUIUtil::HtmlEscape(wtx.tx->ToString(), true);
467 
468  strHTML += "<br><b>" + tr("Inputs") + ":</b>";
469  strHTML += "<ul>";
470 
471  for (const CTxIn& txin : wtx.tx->vin)
472  {
473  COutPoint prevout = txin.prevout;
474 
475  Coin prev;
476  if(pcoinsTip->GetCoin(prevout, prev))
477  {
478  {
479  strHTML += "<li>";
480  const CTxOut &vout = prev.out;
481  CTxDestination address;
482  if (ExtractDestination(vout.scriptPubKey, address))
483  {
484  if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
485  strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
486  strHTML += QString::fromStdString(EncodeDestination(address));
487  }
488  strHTML = strHTML + " " + tr("Amount") + "=" + RavenUnits::formatHtmlWithUnit(unit, vout.nValue);
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>";
491  }
492  }
493  }
494 
495  strHTML += "</ul>";
496 }
CAmount nValue
Definition: transaction.h:140
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:89
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:210
int8_t units
Definition: assettypes.h:102
CScript scriptPubKey
Definition: transaction.h:141
A UTXO entry.
Definition: coins.h:32
std::map< CTxDestination, CAddressBookData > mapAddressBook
Definition: wallet.h:829
CCriticalSection cs_wallet
Definition: wallet.h:751
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
Definition: wallet.cpp:1745
int Height() const
Return the maximal height in the chain.
Definition: chain.h:479
CCriticalSection cs_main
Global state.
Definition: validation.cpp:72
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
Definition: standard.cpp:402
CTxOut out
unspent transaction output
Definition: coins.h:36
CTxDestination DecodeDestination(const std::string &str)
Definition: base58.cpp:333
QString dateTimeStr(const QDateTime &date)
Definition: guiutil.cpp:158
isminetype IsMine(const CKeyStore &keystore, const CScript &scriptPubKey, SigVersion sigversion)
Definition: ismine.cpp:32
QString HtmlEscape(const QString &str, bool fMultiLine)
Definition: guiutil.cpp:336
std::atomic< uint32_t > logCategories
#define OWNER_UNITS
Definition: assets.h:34
RVN START.
Definition: wallet.h:191
mapValue_t mapValue
Key/value map with information about the transaction.
Definition: wallet.h:316
bool GetAssetData(const CScript &script, CAssetOutputEntry &data)
Definition: assets.cpp:3440
int64_t CAmount
Amount in corbies (Can be negative)
Definition: amount.h:13
#define AssertLockHeld(cs)
Definition: sync.h:86
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
Definition: validation.cpp:223
#define LOCK2(cs1, cs2)
Definition: sync.h:177
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.
Definition: validation.cpp:255
bool getMerchant(X509_STORE *certStore, QString &merchant) const
CTransactionRef tx
Definition: wallet.h:211
CAssetsCache * GetCurrentAssetCache()
isminetype
IsMine() return codes.
Definition: ismine.h:18
An input of a transaction.
Definition: transaction.h:67
bool InMempool() const
Definition: wallet.cpp:1905
std::string assetName
Definition: wallet.h:194
QString getTxID() const
Return the unique identifier for this transaction (part)
bool IsCoinBase() const
Definition: wallet.h:278
int GetBlocksToMaturity() const
Definition: wallet.cpp:4783
static QString toAssetHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
An output of a transaction.
Definition: transaction.h:137
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
Definition: validation.cpp:75
static X509_STORE * getCertStore()
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:22
bool parse(const QByteArray &data)
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:285
bool IsInMainChain() const
Definition: wallet.h:269
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: coins.cpp:67
std::string EncodeDestination(const CTxDestination &dest)
Definition: base58.cpp:326
CAmount GetDebit(const CTxIn &txin, const isminefilter &filter) const
Returns amount of debit if the input matches the filter, otherwise returns 0.
Definition: wallet.cpp:1256
CAmount GetCredit(const isminefilter &filter) const
Definition: wallet.cpp:1776
int64_t GetTxTime() const
Definition: wallet.cpp:1458
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit)
Definition: ravenunits.cpp:156
int64_t GetAdjustedTime()
Definition: timedata.cpp:36
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:673
static QString FormatTxStatus(const CWalletTx &wtx)
unsigned int nTimeReceived
time received by this node
Definition: wallet.h:319
CAmount nAmount
Definition: wallet.h:196
CAmount GetCredit(const CTxOut &txout, const isminefilter &filter) const
Definition: wallet.cpp:1289
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)
Definition: ravenunits.cpp:151
isminetype IsMine(const CTxIn &txin) const
Definition: wallet.cpp:1241
COutPoint prevout
Definition: transaction.h:70
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...
Definition: wallet.cpp:4764
CAmount GetChange() const
Definition: wallet.cpp:1896
#define MAX_ASSET_UNITS
Definition: ravenunits.h:15
int GetRequestCount() const
Definition: wallet.cpp:1464
bool IsAssetNameAnOwner(const std::string &name)
Check if an asset is an owner.
Definition: assets.cpp:296
std::vector< std::pair< std::string, std::string > > vOrderForm
Definition: wallet.h:317
bool IsAssetScript(int &nType, bool &fIsOwner, int &nStartingIndex) const
Definition: script.cpp:245
bool isAbandoned() const
Definition: wallet.h:274