PRCYCoin  2.0.0.7rc1
P2P Digital Currency
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 BITCOIN_QT_TRANSACTIONRECORD_H
6 #define BITCOIN_QT_TRANSACTIONRECORD_H
7 
8 #include "amount.h"
9 #include "script/script.h"
10 #include "uint256.h"
11 
12 #include <QList>
13 #include <QString>
14 
15 class CWallet;
16 class CWalletTx;
17 
21 {
22 public:
25  {
26  }
27 
28  enum Status {
37  Immature,
41  };
42 
46  std::string sortKey;
47 
56  qint64 depth;
57  qint64 open_for;
64 
65  //** Know when to update transaction for ix locks **/
67 };
68 
73 {
74 public:
75  enum Type {
85  };
86 
88  static const int RecommendedNumConfirmations = 6;
89 
90  TransactionRecord() : hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0)
91  {
92  }
93 
95  credit(0), idx(0)
96  {
97  }
98 
100  idx(0)
101  {
102  }
103 
106  static QList<TransactionRecord> decomposeTransaction(const CWallet* wallet, const CWalletTx& wtx);
107 
111  qint64 time;
113  std::string address;
119  int idx;
120 
123 
126 
128  QString getTxID() const;
129 
131  int getOutputIndex() const;
132 
135  void updateStatus(const CWalletTx& wtx);
136 
139  bool statusUpdateNeeded();
140 };
141 
142 #endif // BITCOIN_QT_TRANSACTIONRECORD_H
TransactionRecord::StakeMint
@ StakeMint
Definition: transactionrecord.h:78
TransactionRecord::idx
int idx
Subtransaction index, for sort key.
Definition: transactionrecord.h:119
TransactionRecord::statusUpdateNeeded
bool statusUpdateNeeded()
Return whether a status update is needed.
Definition: transactionrecord.cpp:251
TransactionStatus::sortKey
std::string sortKey
Sorting key based on status.
Definition: transactionrecord.h:46
TransactionStatus::OpenUntilDate
@ OpenUntilDate
Normal (sent/received) transactions.
Definition: transactionrecord.h:31
TransactionRecord::status
TransactionStatus status
Status: can change with block chain update.
Definition: transactionrecord.h:122
TransactionRecord::hash
uint256 hash
Definition: transactionrecord.h:110
TransactionRecord::RecvWithAddress
@ RecvWithAddress
Definition: transactionrecord.h:81
uint256.h
TransactionStatus::Conflicted
@ Conflicted
Conflicts with other transaction or mempool.
Definition: transactionrecord.h:36
TransactionRecord::credit
CAmount credit
Definition: transactionrecord.h:115
TransactionRecord::MNReward
@ MNReward
Definition: transactionrecord.h:82
TransactionRecord::updateStatus
void updateStatus(const CWalletTx &wtx)
Update status from core wallet tx.
Definition: transactionrecord.cpp:188
TransactionRecord::RecommendedNumConfirmations
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.
Definition: transactionrecord.h:88
TransactionStatus::TransactionStatus
TransactionStatus()
Definition: transactionrecord.h:23
TransactionRecord::RecvFromOther
@ RecvFromOther
Definition: transactionrecord.h:83
TransactionRecord
UI model for a transaction.
Definition: transactionrecord.h:72
TransactionRecord::time
qint64 time
Definition: transactionrecord.h:111
TransactionStatus::MaturesWarning
@ MaturesWarning
Transaction will likely not mature because no nodes have confirmed.
Definition: transactionrecord.h:39
TransactionStatus::open_for
qint64 open_for
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
Definition: transactionrecord.h:57
TransactionRecord::TransactionRecord
TransactionRecord(uint256 hash, qint64 time, Type type, const std::string &address, const CAmount &debit, const CAmount &credit)
Definition: transactionrecord.h:99
TransactionRecord::SendToOther
@ SendToOther
Definition: transactionrecord.h:80
TransactionRecord::TransactionRecord
TransactionRecord(uint256 hash, qint64 time)
Definition: transactionrecord.h:94
TransactionStatus::Status
Status
Definition: transactionrecord.h:28
TransactionRecord::involvesWatchAddress
bool involvesWatchAddress
Whether the transaction was sent/received with a watch-only address.
Definition: transactionrecord.h:125
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
TransactionRecord::Generated
@ Generated
Definition: transactionrecord.h:77
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
TransactionRecord::debit
CAmount debit
Definition: transactionrecord.h:114
TransactionRecord::SendToSelf
@ SendToSelf
Definition: transactionrecord.h:84
TransactionStatus::Immature
@ Immature
Generated (mined) transactions.
Definition: transactionrecord.h:38
TransactionStatus::OpenUntilBlock
@ OpenUntilBlock
Transaction not yet final, waiting for block.
Definition: transactionrecord.h:32
TransactionRecord::type
Type type
Definition: transactionrecord.h:112
TransactionStatus::Confirmed
@ Confirmed
Have 6 or more confirmations (normal tx) or fully mature (mined tx)
Definition: transactionrecord.h:29
TransactionStatus::cur_num_ix_locks
int cur_num_ix_locks
Definition: transactionrecord.h:66
TransactionRecord::address
std::string address
Definition: transactionrecord.h:113
TransactionRecord::Type
Type
Definition: transactionrecord.h:75
TransactionStatus
UI model for transaction status.
Definition: transactionrecord.h:20
TransactionStatus::Confirming
@ Confirming
Confirmed, but waiting for the recommended number of confirmations.
Definition: transactionrecord.h:35
TransactionRecord::decomposeTransaction
static QList< TransactionRecord > decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx)
Decompose CWallet transaction to model transaction records.
Definition: transactionrecord.cpp:20
TransactionStatus::status
Status status
Definition: transactionrecord.h:55
TransactionStatus::matures_in
int matures_in
Definition: transactionrecord.h:50
CWallet
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:243
CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:792
TransactionRecord::getOutputIndex
int getOutputIndex() const
Return the output index of the subtransaction
Definition: transactionrecord.cpp:262
TransactionStatus::Offline
@ Offline
Not sent to any other nodes.
Definition: transactionrecord.h:33
TransactionRecord::SendToAddress
@ SendToAddress
Definition: transactionrecord.h:79
script.h
TransactionStatus::depth
qint64 depth
Definition: transactionrecord.h:56
TransactionStatus::NotAccepted
@ NotAccepted
Mined but not accepted.
Definition: transactionrecord.h:40
TransactionStatus::countsForBalance
bool countsForBalance
Transaction counts towards available balance.
Definition: transactionrecord.h:44
TransactionStatus::Unconfirmed
@ Unconfirmed
Not yet mined into a block.
Definition: transactionrecord.h:34
TransactionRecord::getTxID
QString getTxID() const
Return the unique identifier for this transaction (part)
Definition: transactionrecord.cpp:257
TransactionRecord::TransactionRecord
TransactionRecord()
Definition: transactionrecord.h:90
amount.h
TransactionStatus::cur_num_blocks
int cur_num_blocks
Current number of blocks (to know whether cached status is still valid)
Definition: transactionrecord.h:63
TransactionRecord::Other
@ Other
Definition: transactionrecord.h:76