Bitcoin Core  0.20.99
P2P Digital Currency
transactionrecord.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2018 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 <uint256.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 }
20 
24 {
25 public:
26  TransactionStatus() : countsForBalance(false), sortKey(""),
27  matures_in(0), status(Unconfirmed), depth(0), open_for(0)
28  { }
29 
30  enum Status {
32  OpenUntilDate,
39  Immature,
41  NotAccepted
42  };
43 
47  std::string sortKey;
48 
57  qint64 depth;
58  qint64 open_for;
64  uint256 m_cur_block_hash{};
65 
67 };
68 
73 {
74 public:
75  enum Type
76  {
83  SendToSelf
84  };
85 
87  static const int RecommendedNumConfirmations = 6;
88 
90  hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
91  {
92  }
93 
94  TransactionRecord(uint256 _hash, qint64 _time):
95  hash(_hash), time(_time), type(Other), address(""), debit(0),
96  credit(0), idx(0)
97  {
98  }
99 
100  TransactionRecord(uint256 _hash, qint64 _time,
101  Type _type, const std::string &_address,
102  const CAmount& _debit, const CAmount& _credit):
103  hash(_hash), time(_time), type(_type), address(_address), debit(_debit), credit(_credit),
104  idx(0)
105  {
106  }
107 
110  static bool showTransaction();
111  static QList<TransactionRecord> decomposeTransaction(const interfaces::WalletTx& wtx);
112 
116  qint64 time;
118  std::string address;
124  int idx;
125 
128 
131 
133  QString getTxHash() const;
134 
136  int getOutputIndex() const;
137 
140  void updateStatus(const interfaces::WalletTxStatus& wtx, const uint256& block_hash, int numBlocks, int64_t block_time);
141 
144  bool statusUpdateNeeded(const uint256& block_hash) const;
145 };
146 
147 #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.
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
std::string sortKey
Sorting key based on status.
TransactionRecord(uint256 _hash, qint64 _time)
Not yet mined into a block.
UI model for transaction status.
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
UI model for a transaction.
TransactionStatus status
Status: can change with block chain update.
bool countsForBalance
Transaction counts towards available balance.
256-bit opaque blob.
Definition: uint256.h:124
Conflicts with other transaction or mempool.
TransactionRecord(uint256 _hash, qint64 _time, Type _type, const std::string &_address, const CAmount &_debit, const CAmount &_credit)
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:385