1 #ifndef TRANSACTIONRECORD_H
2 #define TRANSACTIONRECORD_H
11 /** UI model for transaction status. The transaction status is the part of a transaction that will change over time.
13 class TransactionStatus
17 confirmed(false), sortKey(""), maturity(Mature),
18 matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1)
25 MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */
40 /** @name Generated (mined) transactions
46 /** @name Reported status
50 int64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of blocks */
53 /** Current number of blocks (to know whether cached status is still valid) */
57 /** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has
60 class TransactionRecord
75 /** Number of confirmation needed for transaction */
76 static const int NumConfirmations = 6;
79 hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
83 TransactionRecord(uint256 hash, int64 time):
84 hash(hash), time(time), type(Other), address(""), debit(0),
89 TransactionRecord(uint256 hash, int64 time,
90 Type type, const std::string &address,
91 int64 debit, int64 credit):
92 hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
97 /** Decompose CWallet transaction to model transaction records.
99 static bool showTransaction(const CWalletTx &wtx);
100 static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx);
102 /** @name Immutable transaction attributes
112 /** Subtransaction index, for sort key */
115 /** Status: can change with block chain update */
116 TransactionStatus status;
118 /** Return the unique identifier for this transaction (part) */
119 std::string getTxID();
121 /** Update status from core wallet tx.
123 void updateStatus(const CWalletTx &wtx);
125 /** Return whether a status update is needed.
127 bool statusUpdateNeeded();
130 #endif // TRANSACTIONRECORD_H