Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
TransactionRecord Class Reference

UI model for a transaction. More...

#include <transactionrecord.h>

+ Collaboration diagram for TransactionRecord:

Public Types

enum  Type {
  Other,
  Generated,
  SendToAddress,
  SendToOther,
  RecvWithAddress,
  RecvFromOther,
  SendToSelf
}
 

Public Member Functions

 TransactionRecord ()
 
 TransactionRecord (uint256 hash, qint64 time)
 
 TransactionRecord (uint256 hash, qint64 time, Type type, const std::string &address, qint64 debit, qint64 credit)
 
QString getTxID () const
 Return the unique identifier for this transaction (part) More...
 
void updateStatus (const CWalletTx &wtx)
 Update status from core wallet tx. More...
 
bool statusUpdateNeeded ()
 Return whether a status update is needed. More...
 

Static Public Member Functions

static bool showTransaction (const CWalletTx &wtx)
 Decompose CWallet transaction to model transaction records. More...
 
static QList< TransactionRecorddecomposeTransaction (const CWallet *wallet, const CWalletTx &wtx)
 
static QString formatSubTxId (const uint256 &hash, int vout)
 Format subtransaction id. More...
 

Public Attributes

int idx
 Subtransaction index, for sort key. More...
 
TransactionStatus status
 Status: can change with block chain update. More...
 
Immutable transaction attributes
uint256 hash
 
qint64 time
 
Type type
 
std::string address
 
qint64 debit
 
qint64 credit
 

Static Public Attributes

static const int RecommendedNumConfirmations = 6
 Number of confirmation recommended for accepting a transaction. More...
 

Detailed Description

UI model for a transaction.

A core transaction can be represented by multiple UI transactions if it has multiple outputs.

Definition at line 67 of file transactionrecord.h.

Member Enumeration Documentation

Enumerator
Other 
Generated 
SendToAddress 
SendToOther 
RecvWithAddress 
RecvFromOther 
SendToSelf 

Definition at line 70 of file transactionrecord.h.

Constructor & Destructor Documentation

TransactionRecord::TransactionRecord ( )
inline

Definition at line 84 of file transactionrecord.h.

Referenced by decomposeTransaction().

+ Here is the caller graph for this function:

TransactionRecord::TransactionRecord ( uint256  hash,
qint64  time 
)
inline

Definition at line 89 of file transactionrecord.h.

TransactionRecord::TransactionRecord ( uint256  hash,
qint64  time,
Type  type,
const std::string &  address,
qint64  debit,
qint64  credit 
)
inline

Definition at line 95 of file transactionrecord.h.

Member Function Documentation

QList< TransactionRecord > TransactionRecord::decomposeTransaction ( const CWallet wallet,
const CWalletTx wtx 
)
static

Definition at line 30 of file transactionrecord.cpp.

References address, credit, debit, ExtractDestination(), Generated, CWalletTx::GetChange(), CWalletTx::GetCredit(), CWalletTx::GetDebit(), CTransaction::GetHash(), CWalletTx::GetTxTime(), CTransaction::GetValueOut(), hash, idx, CTransaction::IsCoinBase(), CWallet::IsMine(), IsMine(), CWalletTx::mapValue, CTxOut::nValue, Other, RecvFromOther, RecvWithAddress, CTxOut::scriptPubKey, SendToAddress, SendToOther, SendToSelf, CBase58Data::ToString(), TransactionRecord(), type, CTransaction::vin, and CTransaction::vout.

Referenced by TransactionTablePriv::refreshWallet(), and TransactionTablePriv::updateWallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString TransactionRecord::formatSubTxId ( const uint256 hash,
int  vout 
)
static

Format subtransaction id.

Definition at line 247 of file transactionrecord.cpp.

References strprintf, and base_uint< BITS >::ToString().

Referenced by getTxID(), and TransactionDesc::toHTML().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString TransactionRecord::getTxID ( ) const

Return the unique identifier for this transaction (part)

Definition at line 242 of file transactionrecord.cpp.

References formatSubTxId(), hash, and idx.

Referenced by TransactionTableModel::data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TransactionRecord::showTransaction ( const CWalletTx wtx)
static

Decompose CWallet transaction to model transaction records.

Definition at line 14 of file transactionrecord.cpp.

References CTransaction::IsCoinBase(), and CMerkleTx::IsInMainChain().

Referenced by TransactionTablePriv::refreshWallet(), and TransactionTablePriv::updateWallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TransactionRecord::statusUpdateNeeded ( )

Return whether a status update is needed.

Definition at line 236 of file transactionrecord.cpp.

References AssertLockHeld, chainActive, cs_main, TransactionStatus::cur_num_blocks, CChain::Height(), and status.

Referenced by TransactionTablePriv::index().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TransactionRecord::updateStatus ( const CWalletTx wtx)

Member Data Documentation

std::string TransactionRecord::address
qint64 TransactionRecord::credit
qint64 TransactionRecord::debit
uint256 TransactionRecord::hash
int TransactionRecord::idx

Subtransaction index, for sort key.

Definition at line 119 of file transactionrecord.h.

Referenced by decomposeTransaction(), TransactionTablePriv::describe(), getTxID(), and updateStatus().

const int TransactionRecord::RecommendedNumConfirmations = 6
static

Number of confirmation recommended for accepting a transaction.

Definition at line 82 of file transactionrecord.h.

Referenced by TransactionTableModel::formatTxStatus(), and updateStatus().

TransactionStatus TransactionRecord::status
qint64 TransactionRecord::time
Type TransactionRecord::type

The documentation for this class was generated from the following files: