BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
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:
27  countsForBalance(false), sortKey(""),
29  { }
30 
31  enum Status {
40  Immature,
43  };
44 
48  std::string sortKey;
49 
58  qint64 depth;
59  qint64 open_for;
66 
68 };
69 
74 {
75 public:
76  enum Type
77  {
85  };
86 
88  static const int RecommendedNumConfirmations = 6;
89 
91  hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
92  {
93  }
94 
95  TransactionRecord(uint256 _hash, qint64 _time):
96  hash(_hash), time(_time), type(Other), address(""), debit(0),
97  credit(0), idx(0)
98  {
99  }
100 
101  TransactionRecord(uint256 _hash, qint64 _time,
102  Type _type, const std::string &_address,
103  const CAmount& _debit, const CAmount& _credit):
104  hash(_hash), time(_time), type(_type), address(_address), debit(_debit), credit(_credit),
105  idx(0)
106  {
107  }
108 
111  static bool showTransaction();
112  static QList<TransactionRecord> decomposeTransaction(const interfaces::WalletTx& wtx);
113 
117  qint64 time;
119  std::string address;
125  int idx;
126 
129 
132 
134  QString getTxHash() const;
135 
137  int getOutputIndex() const;
138 
141  void updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime);
142 
145  bool statusUpdateNeeded(int numBlocks) const;
146 };
147 
148 #endif // BITCOIN_QT_TRANSACTIONRECORD_H
bool statusUpdateNeeded(int numBlocks) const
Return whether a status update is needed.
Confirmed, but waiting for the recommended number of confirmations.
Transaction not yet final, waiting for block.
int idx
Subtransaction index, for sort key.
QString getTxHash() const
Return the unique identifier for this transaction (part)
Generated (mined) transactions.
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)
static QList< TransactionRecord > decomposeTransaction(const interfaces::WalletTx &wtx)
Mined but not accepted.
Not yet mined into a block.
UI model for transaction status.
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
void updateStatus(const interfaces::WalletTxStatus &wtx, int numBlocks, int64_t adjustedTime)
Update status from core wallet tx.
int getOutputIndex() const
Return the output index of the subtransaction.
UI model for a transaction.
TransactionStatus status
Status: can change with block chain update.
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.
static bool showTransaction()
Decompose CWallet transaction to model transaction records.
256-bit opaque blob.
Definition: uint256.h:122
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:346
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.