Master Core  v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
transactionrecord.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef TRANSACTIONRECORD_H
6 #define TRANSACTIONRECORD_H
7 
8 #include "uint256.h"
9 
10 #include <QList>
11 #include <QString>
12 
13 class CWallet;
14 class CWalletTx;
15 
19 {
20 public:
22  countsForBalance(false), sortKey(""),
24  { }
25 
26  enum Status {
35  Immature,
39  };
40 
44  std::string sortKey;
45 
54  qint64 depth;
55  qint64 open_for;
62 };
63 
68 {
69 public:
70  enum Type
71  {
79  };
80 
82  static const int RecommendedNumConfirmations = 6;
83 
85  hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
86  {
87  }
88 
90  hash(hash), time(time), type(Other), address(""), debit(0),
91  credit(0), idx(0)
92  {
93  }
94 
96  Type type, const std::string &address,
97  qint64 debit, qint64 credit):
98  hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
99  idx(0)
100  {
101  }
102 
105  static bool showTransaction(const CWalletTx &wtx);
106  static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx);
107 
111  qint64 time;
113  std::string address;
114  qint64 debit;
115  qint64 credit;
119  int idx;
120 
123 
125  QString getTxID() const;
126 
128  static QString formatSubTxId(const uint256 &hash, int vout);
129 
132  void updateStatus(const CWalletTx &wtx);
133 
136  bool statusUpdateNeeded();
137 };
138 
139 #endif // TRANSACTIONRECORD_H
TransactionRecord(uint256 hash, qint64 time)
Status status
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
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.
qint64 depth
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
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:451
256-bit unsigned integer
Definition: uint256.h:531
Conflicts with other transaction or mempool.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:100
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.