Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionrecord.h
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_QT_TRANSACTIONRECORD_H | #ifndef BITCOIN_QT_TRANSACTIONRECORD_H | ||||
#define BITCOIN_QT_TRANSACTIONRECORD_H | #define BITCOIN_QT_TRANSACTIONRECORD_H | ||||
#include "amount.h" | #include "amount.h" | ||||
#include "primitives/transaction.h" | |||||
#include "uint256.h" | #include "uint256.h" | ||||
#include <QList> | #include <QList> | ||||
#include <QString> | #include <QString> | ||||
class CWallet; | class CWallet; | ||||
class CWalletTx; | class CWalletTx; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | public: | ||||
/** Number of confirmation recommended for accepting a transaction */ | /** Number of confirmation recommended for accepting a transaction */ | ||||
static const int RecommendedNumConfirmations = 6; | static const int RecommendedNumConfirmations = 6; | ||||
TransactionRecord() | TransactionRecord() | ||||
: hash(), time(0), type(Other), address(""), debit(0), credit(0), | : hash(), time(0), type(Other), address(""), debit(0), credit(0), | ||||
idx(0) {} | idx(0) {} | ||||
TransactionRecord(uint256 _hash, qint64 _time) | TransactionRecord(txhash_t _hash, qint64 _time) | ||||
: hash(_hash), time(_time), type(Other), address(""), debit(0), | : hash(_hash), time(_time), type(Other), address(""), debit(0), | ||||
credit(0), idx(0) {} | credit(0), idx(0) {} | ||||
TransactionRecord(uint256 _hash, qint64 _time, Type _type, | TransactionRecord(txhash_t _hash, qint64 _time, Type _type, | ||||
const std::string &_address, const CAmount &_debit, | const std::string &_address, const CAmount &_debit, | ||||
const CAmount &_credit) | const CAmount &_credit) | ||||
: hash(_hash), time(_time), type(_type), address(_address), | : hash(_hash), time(_time), type(_type), address(_address), | ||||
debit(_debit), credit(_credit), idx(0) {} | debit(_debit), credit(_credit), idx(0) {} | ||||
/** Decompose CWallet transaction to model transaction records. | /** Decompose CWallet transaction to model transaction records. | ||||
*/ | */ | ||||
static bool showTransaction(const CWalletTx &wtx); | static bool showTransaction(const CWalletTx &wtx); | ||||
static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, | static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, | ||||
const CWalletTx &wtx); | const CWalletTx &wtx); | ||||
/** @name Immutable transaction attributes | /** @name Immutable transaction attributes | ||||
@{*/ | @{*/ | ||||
uint256 hash; | txhash_t hash; | ||||
qint64 time; | qint64 time; | ||||
Type type; | Type type; | ||||
std::string address; | std::string address; | ||||
CAmount debit; | CAmount debit; | ||||
CAmount credit; | CAmount credit; | ||||
/**@}*/ | /**@}*/ | ||||
/** Subtransaction index, for sort key */ | /** Subtransaction index, for sort key */ | ||||
int idx; | int idx; | ||||
/** Status: can change with block chain update */ | /** Status: can change with block chain update */ | ||||
TransactionStatus status; | TransactionStatus status; | ||||
/** Whether the transaction was sent/received with a watch-only address */ | /** Whether the transaction was sent/received with a watch-only address */ | ||||
bool involvesWatchAddress; | bool involvesWatchAddress; | ||||
/** Return the unique identifier for this transaction (part) */ | /** Return the unique identifier for this transaction (part) */ | ||||
QString getTxID() const; | QString getTxHash() const; | ||||
/** Return the output index of the subtransaction */ | /** Return the output index of the subtransaction */ | ||||
int getOutputIndex() const; | int getOutputIndex() const; | ||||
/** Update status from core wallet tx. | /** Update status from core wallet tx. | ||||
*/ | */ | ||||
void updateStatus(const CWalletTx &wtx); | void updateStatus(const CWalletTx &wtx); | ||||
/** Return whether a status update is needed. | /** Return whether a status update is needed. | ||||
*/ | */ | ||||
bool statusUpdateNeeded(); | bool statusUpdateNeeded(); | ||||
}; | }; | ||||
#endif // BITCOIN_QT_TRANSACTIONRECORD_H | #endif // BITCOIN_QT_TRANSACTIONRECORD_H |