Anoncoin  0.9.4
P2P Digital Currency
transactionrecord.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2013-2014 The Anoncoin Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef TRANSACTIONRECORD_H
7 #define TRANSACTIONRECORD_H
8 
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 {
36  Immature,
40  };
41 
45  std::string sortKey;
46 
55  qint64 depth;
56  qint64 open_for;
63 };
64 
69 {
70 public:
71  enum Type
72  {
80  };
81 
83  static const int RecommendedNumConfirmations = 6;
84 
86  hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
87  {
88  }
89 
91  hash(hash), time(time), type(Other), address(""), debit(0),
92  credit(0), idx(0)
93  {
94  }
95 
97  Type type, const std::string &address,
98  qint64 debit, qint64 credit):
99  hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
100  idx(0)
101  {
102  }
103 
106  static bool showTransaction(const CWalletTx &wtx);
107  static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx);
108 
112  qint64 time;
114  std::string address;
115  qint64 debit;
116  qint64 credit;
120  int idx;
121 
124 
127 
129  QString getTxID() const;
130 
132  static QString formatSubTxId(const uint256 &hash, int vout);
133 
136  void updateStatus(const CWalletTx &wtx);
137 
140  bool statusUpdateNeeded();
141 };
142 
143 #endif // TRANSACTIONRECORD_H
TransactionRecord(uint256 hash, qint64 time)
Confirmed, but waiting for the recommended number of confirmations.
Transaction not yet final, waiting for block.
int idx
Subtransaction index, for sort key.
QString getTxID() const
Return the unique identifier for this transaction (part)
Not sent to any other nodes.
Generated (mined) transactions.
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
std::string sortKey
Sorting key based on status.
Mined but not accepted.
Not yet mined into a block.
static bool showTransaction(const CWalletTx &wtx)
Decompose CWallet transaction to model transaction records.
UI model for transaction status.
UI model for a transaction.
TransactionStatus status
Status: can change with block chain update.
TransactionRecord(uint256 hash, qint64 time, Type type, const std::string &address, qint64 debit, qint64 credit)
static QList< TransactionRecord > decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx)
static QString formatSubTxId(const uint256 &hash, int vout)
Format subtransaction id.
bool countsForBalance
Transaction counts towards available balance.
void updateStatus(const CWalletTx &wtx)
Update status from core wallet tx.
int cur_num_blocks
Current number of blocks (to know whether cached status is still valid)
Normal (sent/received) transactions.
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:464
256-bit unsigned integer
Definition: uint256.h:532
Conflicts with other transaction or mempool.
bool involvesWatchAddress
Whether the transaction was sent/received with a watch-only address.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:101
bool statusUpdateNeeded()
Return whether a status update is needed.
qint64 open_for
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.
Transaction will likely not mature because no nodes have confirmed.