Bitcoin ABC  0.22.12
P2P Digital Currency
transactionrecord.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_TRANSACTIONRECORD_H
6 #define BITCOIN_QT_TRANSACTIONRECORD_H
7 
8 #include <amount.h>
9 #include <primitives/txid.h>
10 
11 #include <QList>
12 #include <QString>
13 
14 namespace interfaces {
15 class Node;
16 class Wallet;
17 struct WalletTx;
18 struct WalletTxStatus;
19 } // namespace interfaces
20 
26 public:
28  : countsForBalance(false), sortKey(""), matures_in(0),
29  status(Unconfirmed), depth(0), open_for(0), cur_num_blocks(-1) {}
30 
31  enum Status {
37 
52 
55  NotAccepted
56  };
57 
61  std::string sortKey;
62 
71  qint64 depth;
76  qint64 open_for;
77 
83 };
84 
90 public:
91  enum Type {
98  SendToSelf
99  };
100 
102  static const int RecommendedNumConfirmations = 6;
103 
105  : txid(), time(0), type(Other), address(""), debit(), credit(), idx(0) {
106  }
107 
108  TransactionRecord(TxId _txid, qint64 _time)
109  : txid(_txid), time(_time), type(Other), address(""), debit(), credit(),
110  idx(0) {}
111 
112  TransactionRecord(TxId _txid, qint64 _time, Type _type,
113  const std::string &_address, const Amount _debit,
114  const Amount _credit)
115  : txid(_txid), time(_time), type(_type), address(_address),
116  debit(_debit), credit(_credit), idx(0) {}
117 
120  static bool showTransaction();
121  static QList<TransactionRecord>
122  decomposeTransaction(const interfaces::WalletTx &wtx);
123 
127  qint64 time;
129  std::string address;
135  int idx;
136 
139 
142 
144  QString getTxID() const;
145 
147  int getOutputIndex() const;
148 
151  void updateStatus(const interfaces::WalletTxStatus &wtx, int numBlocks,
152  int64_t block_time);
153 
156  bool statusUpdateNeeded(int numBlocks) const;
157 };
158 
159 #endif // BITCOIN_QT_TRANSACTIONRECORD_H
Confirmed, but waiting for the recommended number of confirmations.
Transaction not yet final, waiting for block.
int idx
Subtransaction index, for sort key.
Generated (mined) transactions.
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
std::string sortKey
Sorting key based on status.
Definition: amount.h:17
Not yet mined into a block.
UI model for transaction status.
UI model for a transaction.
TransactionStatus status
Status: can change with block chain update.
TransactionRecord(TxId _txid, qint64 _time, Type _type, const std::string &_address, const Amount _debit, const Amount _credit)
bool countsForBalance
Transaction counts towards available balance.
int cur_num_blocks
Current number of blocks (to know whether cached status is still valid)
Normal (sent/received) transactions.
Conflicts with other transaction or mempool.
A TxId is the identifier of a transaction.
Definition: txid.h:14
bool involvesWatchAddress
Whether the transaction was sent/received with a watch-only address.
qint64 open_for
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
Abandoned from the wallet.
Updated transaction status.
Definition: wallet.h:355
TransactionRecord(TxId _txid, qint64 _time)