X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Ftransactionrecord.h;h=15b76cc044a5440d1815a080187bc7ea91159abc;hb=77a43545b4491b9703d803765da9059d2bdd5aaa;hp=ba071dfdc9a91095e59e846442e858812bb3633c;hpb=e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98;p=novacoin.git diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index ba071df..15b76cc 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -1,12 +1,15 @@ #ifndef TRANSACTIONRECORD_H #define TRANSACTIONRECORD_H -#include "main.h" +#include "uint256.h" #include class CWallet; +class CWalletTx; +/** UI model for transaction status. The transaction status is the part of a transaction that will change over time. + */ class TransactionStatus { public: @@ -19,7 +22,7 @@ public: { Immature, Mature, - MaturesWarning, /* Will likely not mature because no nodes have confirmed */ + MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */ NotAccepted }; @@ -34,19 +37,26 @@ public: bool confirmed; std::string sortKey; - /* For "Generated" transactions */ + /** @name Generated (mined) transactions + @{*/ Maturity maturity; int matures_in; + /**@}*/ - /* Reported status */ + /** @name Reported status + @{*/ Status status; - int64 depth; - int64 open_for; /* Timestamp if status==OpenUntilDate, otherwise number of blocks */ + int64_t depth; + int64_t open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of blocks */ + /**@}*/ - /* Current number of blocks (to know whether cached status is still valid. */ + /** Current number of blocks (to know whether cached status is still valid) */ int cur_num_blocks; }; +/** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has + multiple outputs. + */ class TransactionRecord { public: @@ -55,13 +65,13 @@ public: Other, Generated, SendToAddress, - SendToIP, + SendToOther, RecvWithAddress, - RecvFromIP, + RecvFromOther, SendToSelf }; - /* Number of confirmation needed for transaction */ + /** Number of confirmation needed for transaction */ static const int NumConfirmations = 6; TransactionRecord(): @@ -69,44 +79,49 @@ public: { } - TransactionRecord(uint256 hash, int64 time): + TransactionRecord(uint256 hash, int64_t time): hash(hash), time(time), type(Other), address(""), debit(0), credit(0), idx(0) { } - TransactionRecord(uint256 hash, int64 time, + TransactionRecord(uint256 hash, int64_t time, Type type, const std::string &address, - int64 debit, int64 credit): + int64_t debit, int64_t credit): hash(hash), time(time), type(type), address(address), 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 QList decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx); - /* Fixed */ + /** @name Immutable transaction attributes + @{*/ uint256 hash; - int64 time; + int64_t time; Type type; std::string address; - int64 debit; - int64 credit; + int64_t debit; + int64_t credit; + /**@}*/ - /* Subtransaction index, for sort key */ + /** Subtransaction index, for sort key */ int idx; - /* Status: can change with block chain update */ + /** Status: can change with block chain update */ TransactionStatus status; - /* Update status from wallet tx. + /** Return the unique identifier for this transaction (part) */ + std::string getTxID(); + + /** Update status from core wallet tx. */ void updateStatus(const CWalletTx &wtx); - /* Is a status update needed? + /** Return whether a status update is needed. */ bool statusUpdateNeeded(); };