Bitcoin ABC  0.24.7
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/blockhash.h>
10 #include <primitives/txid.h>
11 
12 #include <QList>
13 #include <QString>
14 
15 namespace interfaces {
16 class Node;
17 class Wallet;
18 struct WalletTx;
19 struct WalletTxStatus;
20 } // namespace interfaces
21 
27 public:
29  : countsForBalance(false), sortKey(""), matures_in(0),
30  status(Unconfirmed), depth(0), open_for(0) {}
31 
32  enum Status {
38 
53 
57  };
58 
62  std::string sortKey;
63 
72  qint64 depth;
77  qint64 open_for;
78 
85 };
86 
92 public:
93  enum Type {
101  };
102 
104  static const int RecommendedNumConfirmations = 6;
105 
107  : txid(), time(0), type(Other), address(""), debit(), credit(), idx(0) {
108  }
109 
110  TransactionRecord(TxId _txid, qint64 _time)
111  : txid(_txid), time(_time), type(Other), address(""), debit(), credit(),
112  idx(0) {}
113 
114  TransactionRecord(TxId _txid, qint64 _time, Type _type,
115  const std::string &_address, const Amount _debit,
116  const Amount _credit)
117  : txid(_txid), time(_time), type(_type), address(_address),
118  debit(_debit), credit(_credit), idx(0) {}
119 
122  static bool showTransaction();
123  static QList<TransactionRecord>
125 
129  qint64 time;
131  std::string address;
137  int idx;
138 
141 
144 
146  QString getTxID() const;
147 
149  int getOutputIndex() const;
150 
154  const BlockHash &block_hash, int numBlocks,
155  int64_t block_time);
156 
159  bool statusUpdateNeeded(const BlockHash &block_hash) const;
160 };
161 
162 #endif // BITCOIN_QT_TRANSACTIONRECORD_H
TransactionRecord::txid
TxId txid
Definition: transactionrecord.h:128
interfaces
Definition: dummywallet.cpp:12
TransactionRecord::idx
int idx
Subtransaction index, for sort key.
Definition: transactionrecord.h:137
TransactionRecord::decomposeTransaction
static QList< TransactionRecord > decomposeTransaction(const interfaces::WalletTx &wtx)
Decompose CWallet transaction to model transaction records.
Definition: transactionrecord.cpp:31
TransactionStatus::sortKey
std::string sortKey
Sorting key based on status.
Definition: transactionrecord.h:62
TransactionStatus::OpenUntilDate
@ OpenUntilDate
Normal (sent/received) transactions.
Definition: transactionrecord.h:39
TransactionRecord::status
TransactionStatus status
Status: can change with block chain update.
Definition: transactionrecord.h:140
TransactionRecord::RecvWithAddress
@ RecvWithAddress
Definition: transactionrecord.h:98
TransactionRecord::debit
Amount debit
Definition: transactionrecord.h:132
TransactionStatus::Conflicted
@ Conflicted
Conflicts with other transaction or mempool.
Definition: transactionrecord.h:49
TransactionStatus::m_cur_block_hash
BlockHash m_cur_block_hash
Current block hash (to know whether cached status is still valid)
Definition: transactionrecord.h:84
blockhash.h
TransactionRecord::RecommendedNumConfirmations
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.
Definition: transactionrecord.h:104
TransactionStatus::TransactionStatus
TransactionStatus()
Definition: transactionrecord.h:28
TransactionRecord::RecvFromOther
@ RecvFromOther
Definition: transactionrecord.h:99
TransactionRecord
UI model for a transaction.
Definition: transactionrecord.h:91
TransactionRecord::time
qint64 time
Definition: transactionrecord.h:129
TransactionStatus::open_for
qint64 open_for
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
Definition: transactionrecord.h:77
TransactionRecord::SendToOther
@ SendToOther
Definition: transactionrecord.h:97
TransactionStatus::Status
Status
Definition: transactionrecord.h:32
TransactionRecord::involvesWatchAddress
bool involvesWatchAddress
Whether the transaction was sent/received with a watch-only address.
Definition: transactionrecord.h:143
TransactionRecord::statusUpdateNeeded
bool statusUpdateNeeded(const BlockHash &block_hash) const
Return whether a status update is needed.
Definition: transactionrecord.cpp:215
interfaces::WalletTx
Definition: wallet.h:372
TransactionRecord::TransactionRecord
TransactionRecord(TxId _txid, qint64 _time, Type _type, const std::string &_address, const Amount _debit, const Amount _credit)
Definition: transactionrecord.h:114
TransactionRecord::Generated
@ Generated
Definition: transactionrecord.h:95
interfaces::WalletTxStatus
Updated transaction status.
Definition: wallet.h:387
TxId
A TxId is the identifier of a transaction.
Definition: txid.h:14
TransactionStatus::Abandoned
@ Abandoned
Abandoned from the wallet.
Definition: transactionrecord.h:51
TransactionRecord::SendToSelf
@ SendToSelf
Definition: transactionrecord.h:100
Amount
Definition: amount.h:19
TransactionStatus::Immature
@ Immature
Generated (mined) transactions.
Definition: transactionrecord.h:54
TransactionStatus::OpenUntilBlock
@ OpenUntilBlock
Transaction not yet final, waiting for block.
Definition: transactionrecord.h:41
TransactionRecord::type
Type type
Definition: transactionrecord.h:130
BlockHash
A BlockHash is a unqiue identifier for a block.
Definition: blockhash.h:13
TransactionStatus::Confirmed
@ Confirmed
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
Definition: transactionrecord.h:36
TransactionRecord::address
std::string address
Definition: transactionrecord.h:131
TransactionRecord::Type
Type
Definition: transactionrecord.h:93
TransactionStatus
UI model for transaction status.
Definition: transactionrecord.h:26
TransactionStatus::Confirming
@ Confirming
Confirmed, but waiting for the recommended number of confirmations.
Definition: transactionrecord.h:47
TransactionStatus::status
Status status
Definition: transactionrecord.h:71
TransactionStatus::matures_in
int matures_in
Definition: transactionrecord.h:66
TransactionRecord::credit
Amount credit
Definition: transactionrecord.h:133
TransactionRecord::getOutputIndex
int getOutputIndex() const
Return the output index of the subtransaction
Definition: transactionrecord.cpp:224
TransactionRecord::SendToAddress
@ SendToAddress
Definition: transactionrecord.h:96
TransactionRecord::TransactionRecord
TransactionRecord(TxId _txid, qint64 _time)
Definition: transactionrecord.h:110
TransactionStatus::depth
qint64 depth
Definition: transactionrecord.h:72
txid.h
TransactionStatus::NotAccepted
@ NotAccepted
Mined but not accepted.
Definition: transactionrecord.h:56
TransactionStatus::countsForBalance
bool countsForBalance
Transaction counts towards available balance.
Definition: transactionrecord.h:60
TransactionStatus::Unconfirmed
@ Unconfirmed
Not yet mined into a block.
Definition: transactionrecord.h:43
TransactionRecord::getTxID
QString getTxID() const
Return the unique identifier for this transaction (part)
Definition: transactionrecord.cpp:220
TransactionRecord::TransactionRecord
TransactionRecord()
Definition: transactionrecord.h:106
amount.h
TransactionRecord::updateStatus
void updateStatus(const interfaces::WalletTxStatus &wtx, const BlockHash &block_hash, int numBlocks, int64_t block_time)
Update status from core wallet tx.
Definition: transactionrecord.cpp:163
TransactionRecord::Other
@ Other
Definition: transactionrecord.h:94
TransactionRecord::showTransaction
static bool showTransaction()
Decompose CWallet transaction to model transaction records.
Definition: transactionrecord.cpp:21