Dogecoin Core  1.14.2
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 "uint256.h"
10 
11 #include <QList>
12 #include <QString>
13 
14 class CWallet;
15 class CWalletTx;
16 
20 {
21 public:
23  countsForBalance(false), sortKey(""),
25  { }
26 
27  enum Status {
41  };
42 
46  std::string sortKey;
47 
56  qint64 depth;
57  qint64 open_for;
64 };
65 
70 {
71 public:
72  enum Type
73  {
81  };
82 
84  static const int RecommendedNumConfirmations = 6;
85 
87  hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
88  {
89  }
90 
91  TransactionRecord(uint256 _hash, qint64 _time):
92  hash(_hash), time(_time), type(Other), address(""), debit(0),
93  credit(0), idx(0)
94  {
95  }
96 
97  TransactionRecord(uint256 _hash, qint64 _time,
98  Type _type, const std::string &_address,
99  const CAmount& _debit, const CAmount& _credit):
100  hash(_hash), time(_time), type(_type), address(_address), debit(_debit), credit(_credit),
101  idx(0)
102  {
103  }
104 
107  static bool showTransaction(const CWalletTx &wtx);
108  static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx);
109 
113  qint64 time;
115  std::string address;
121  int idx;
122 
125 
128 
130  QString getTxID() const;
131 
133  int getOutputIndex() const;
134 
137  void updateStatus(const CWalletTx &wtx);
138 
141  bool statusUpdateNeeded();
142 };
143 
144 #endif // BITCOIN_QT_TRANSACTIONRECORD_H
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:15
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:493
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:177
UI model for a transaction.
int idx
Subtransaction index, for sort key.
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.
TransactionRecord(uint256 _hash, qint64 _time)
TransactionStatus status
Status: can change with block chain update.
int getOutputIndex() const
Return the output index of the subtransaction
static bool showTransaction(const CWalletTx &wtx)
Decompose CWallet transaction to model transaction records.
QString getTxID() const
Return the unique identifier for this transaction (part)
void updateStatus(const CWalletTx &wtx)
Update status from core wallet tx.
static QList< TransactionRecord > decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx)
bool statusUpdateNeeded()
Return whether a status update is needed.
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.
UI model for transaction status.
bool countsForBalance
Transaction counts towards available balance.
int cur_num_blocks
Current number of blocks (to know whether cached status is still valid)
qint64 open_for
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
@ MaturesWarning
Transaction will likely not mature because no nodes have confirmed.
@ Confirmed
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
@ OpenUntilDate
Normal (sent/received) transactions.
@ Unconfirmed
Not yet mined into a block.
@ Immature
Generated (mined) transactions.
@ Confirming
Confirmed, but waiting for the recommended number of confirmations.
@ NotAccepted
Mined but not accepted.
@ OpenUntilBlock
Transaction not yet final, waiting for block.
@ Conflicted
Conflicts with other transaction or mempool.
@ Abandoned
Abandoned from the wallet.
@ Offline
Not sent to any other nodes.
std::string sortKey
Sorting key based on status.
256-bit opaque blob.
Definition: uint256.h:123