Bitcoin ABC 0.30.7
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 <consensus/amount.h>
10#include <primitives/txid.h>
11
12#include <QList>
13#include <QString>
14
15namespace interfaces {
16class Node;
17class Wallet;
18struct WalletTx;
19struct WalletTxStatus;
20} // namespace interfaces
21
27public:
29 : countsForBalance(false), sortKey(""), matures_in(0),
31
32 enum Status {
38
49
53 };
54
58 std::string sortKey;
59
68 qint64 depth;
73 qint64 open_for;
74
81};
82
88public:
89 enum Type {
97 };
98
100 static const int RecommendedNumConfirmations = 6;
101
103 : txid(), time(0), type(Other), address(""), debit(), credit(), idx(0) {
104 }
105
106 TransactionRecord(TxId _txid, qint64 _time)
107 : txid(_txid), time(_time), type(Other), address(""), debit(), credit(),
108 idx(0) {}
109
110 TransactionRecord(TxId _txid, qint64 _time, Type _type,
111 const std::string &_address, const Amount _debit,
112 const Amount _credit)
113 : txid(_txid), time(_time), type(_type), address(_address),
114 debit(_debit), credit(_credit), idx(0) {}
115
118 static bool showTransaction();
119 static QList<TransactionRecord>
121
125 qint64 time;
127 std::string address;
133 int idx;
134
137
140
142 QString getTxID() const;
143
145 int getOutputIndex() const;
146
150 const BlockHash &block_hash, int numBlocks,
151 int64_t block_time);
152
155 bool statusUpdateNeeded(const BlockHash &block_hash) const;
156};
157
158#endif // BITCOIN_QT_TRANSACTIONRECORD_H
UI model for a transaction.
int idx
Subtransaction index, for sort key.
static QList< TransactionRecord > decomposeTransaction(const interfaces::WalletTx &wtx)
Decompose CWallet transaction to model transaction records.
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.
static bool showTransaction()
Decompose CWallet transaction to model transaction records.
TransactionStatus status
Status: can change with block chain update.
int getOutputIndex() const
Return the output index of the subtransaction
void updateStatus(const interfaces::WalletTxStatus &wtx, const BlockHash &block_hash, int numBlocks, int64_t block_time)
Update status from core wallet tx.
bool statusUpdateNeeded(const BlockHash &block_hash) const
Return whether a status update is needed.
TransactionRecord(TxId _txid, qint64 _time)
QString getTxID() const
Return the unique identifier for this transaction (part)
bool involvesWatchAddress
Whether the transaction was sent/received with a watch-only address.
TransactionRecord(TxId _txid, qint64 _time, Type _type, const std::string &_address, const Amount _debit, const Amount _credit)
UI model for transaction status.
bool countsForBalance
Transaction counts towards available balance.
BlockHash m_cur_block_hash
Current block hash (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...
@ Confirmed
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
@ Unconfirmed
Normal (sent/received) transactions.
@ Immature
Generated (mined) transactions.
@ Confirming
Confirmed, but waiting for the recommended number of confirmations.
@ NotAccepted
Mined but not accepted.
@ Conflicted
Conflicts with other transaction or mempool.
@ Abandoned
Abandoned from the wallet.
std::string sortKey
Sorting key based on status.
Definition: amount.h:19
A BlockHash is a unqiue identifier for a block.
Definition: blockhash.h:13
A TxId is the identifier of a transaction.
Definition: txid.h:14
Updated transaction status.
Definition: wallet.h:383