Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
qt
transactionrecord.h
Go to the documentation of this file.
1
// Copyright (c) 2011-present 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
>
9
#include <
primitives/transaction_identifier.h
>
10
#include <
uint256.h
>
11
12
#include <QList>
13
#include <QString>
14
15
namespace
interfaces
{
16
class
Node
;
17
class
Wallet
;
18
struct
WalletTx
;
19
struct
WalletTxStatus
;
20
}
21
24
struct
TransactionStatus
{
25
enum
Status
{
26
Confirmed
,
28
Unconfirmed
,
29
Confirming
,
30
Conflicted
,
31
Abandoned
,
33
Immature
,
34
NotAccepted
35
};
36
38
bool
countsForBalance
{
false
};
40
std::string
sortKey
;
41
44
int
matures_in
{0};
46
49
Status
status
{
Unconfirmed
};
50
qint64
depth
{0};
52
54
uint256
m_cur_block_hash
{};
55
56
bool
needsUpdate
{
false
};
57
};
58
62
class
TransactionRecord
63
{
64
public
:
65
enum
Type
66
{
67
Other
,
68
Generated
,
69
SendToAddress
,
70
SendToOther
,
71
RecvWithAddress
,
72
RecvFromOther
,
73
};
74
76
static
const
int
RecommendedNumConfirmations
= 6;
77
78
TransactionRecord
():
79
hash
(),
time
(0),
type
(
Other
),
debit
(0),
credit
(0),
idx
(0)
80
{
81
}
82
83
TransactionRecord
(
Txid
_hash, qint64 _time):
84
hash
(_hash),
time
(_time),
type
(
Other
),
debit
(0),
85
credit
(0),
idx
(0)
86
{
87
}
88
89
TransactionRecord
(
Txid
_hash, qint64 _time,
90
Type
_type,
const
std::string &_address,
91
const
CAmount
& _debit,
const
CAmount
& _credit):
92
hash
(_hash),
time
(_time),
type
(_type),
address
(_address),
debit
(_debit),
credit
(_credit),
93
idx
(0)
94
{
95
}
96
99
static
bool
showTransaction
();
100
static
QList<TransactionRecord>
decomposeTransaction
(
const
interfaces::WalletTx
& wtx);
101
104
Txid
hash
;
105
qint64
time
;
106
Type
type
;
107
std::string
address
;
108
CAmount
debit
;
109
CAmount
credit
;
111
113
int
idx
;
114
116
TransactionStatus
status
;
117
119
QString
getTxHash
()
const
;
120
122
int
getOutputIndex
()
const
;
123
126
void
updateStatus
(
const
interfaces::WalletTxStatus
& wtx,
const
uint256
& block_hash,
int
numBlocks, int64_t block_time);
127
130
bool
statusUpdateNeeded
(
const
uint256
& block_hash)
const
;
131
};
132
133
#endif
// BITCOIN_QT_TRANSACTIONRECORD_H
amount.h
CAmount
int64_t CAmount
Amount in satoshis (Can be negative).
Definition
amount.h:12
TransactionRecord::TransactionRecord
TransactionRecord(Txid _hash, qint64 _time)
Definition
transactionrecord.h:83
TransactionRecord::idx
int idx
Subtransaction index, for sort key.
Definition
transactionrecord.h:113
TransactionRecord::decomposeTransaction
static QList< TransactionRecord > decomposeTransaction(const interfaces::WalletTx &wtx)
Definition
transactionrecord.cpp:27
TransactionRecord::RecommendedNumConfirmations
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction.
Definition
transactionrecord.h:76
TransactionRecord::TransactionRecord
TransactionRecord(Txid _hash, qint64 _time, Type _type, const std::string &_address, const CAmount &_debit, const CAmount &_credit)
Definition
transactionrecord.h:89
TransactionRecord::hash
Txid hash
Definition
transactionrecord.h:104
TransactionRecord::showTransaction
static bool showTransaction()
Decompose CWallet transaction to model transaction records.
Definition
transactionrecord.cpp:17
TransactionRecord::status
TransactionStatus status
Status: can change with block chain update.
Definition
transactionrecord.h:116
TransactionRecord::getOutputIndex
int getOutputIndex() const
Return the output index of the subtransaction.
Definition
transactionrecord.cpp:215
TransactionRecord::debit
CAmount debit
Definition
transactionrecord.h:108
TransactionRecord::type
Type type
Definition
transactionrecord.h:106
TransactionRecord::getTxHash
QString getTxHash() const
Return the unique identifier for this transaction (part).
Definition
transactionrecord.cpp:210
TransactionRecord::statusUpdateNeeded
bool statusUpdateNeeded(const uint256 &block_hash) const
Return whether a status update is needed.
Definition
transactionrecord.cpp:204
TransactionRecord::TransactionRecord
TransactionRecord()
Definition
transactionrecord.h:78
TransactionRecord::updateStatus
void updateStatus(const interfaces::WalletTxStatus &wtx, const uint256 &block_hash, int numBlocks, int64_t block_time)
Update status from core wallet tx.
Definition
transactionrecord.cpp:136
TransactionRecord::address
std::string address
Definition
transactionrecord.h:107
TransactionRecord::credit
CAmount credit
Definition
transactionrecord.h:109
TransactionRecord::Type
Type
Definition
transactionrecord.h:66
TransactionRecord::SendToOther
@ SendToOther
Definition
transactionrecord.h:70
TransactionRecord::SendToAddress
@ SendToAddress
Definition
transactionrecord.h:69
TransactionRecord::RecvWithAddress
@ RecvWithAddress
Definition
transactionrecord.h:71
TransactionRecord::Generated
@ Generated
Definition
transactionrecord.h:68
TransactionRecord::Other
@ Other
Definition
transactionrecord.h:67
TransactionRecord::RecvFromOther
@ RecvFromOther
Definition
transactionrecord.h:72
TransactionRecord::time
qint64 time
Definition
transactionrecord.h:105
interfaces::Node
Top-level interface for a bitcoin node (bitcoind process).
Definition
node.h:70
interfaces::Wallet
Interface for accessing a wallet.
Definition
wallet.h:66
uint256
256-bit opaque blob.
Definition
uint256.h:195
interfaces
Definition
interfaces.cpp:41
TransactionStatus
UI model for transaction status.
Definition
transactionrecord.h:24
TransactionStatus::countsForBalance
bool countsForBalance
Transaction counts towards available balance.
Definition
transactionrecord.h:38
TransactionStatus::m_cur_block_hash
uint256 m_cur_block_hash
Current block hash (to know whether cached status is still valid).
Definition
transactionrecord.h:54
TransactionStatus::matures_in
int matures_in
Definition
transactionrecord.h:44
TransactionStatus::status
Status status
Definition
transactionrecord.h:49
TransactionStatus::Status
Status
Definition
transactionrecord.h:25
TransactionStatus::Confirmed
@ Confirmed
Have 6 or more confirmations (normal tx) or fully mature (mined tx).
Definition
transactionrecord.h:26
TransactionStatus::Unconfirmed
@ Unconfirmed
Normal (sent/received) transactions.
Definition
transactionrecord.h:28
TransactionStatus::Immature
@ Immature
Generated (mined) transactions.
Definition
transactionrecord.h:33
TransactionStatus::Confirming
@ Confirming
Confirmed, but waiting for the recommended number of confirmations.
Definition
transactionrecord.h:29
TransactionStatus::NotAccepted
@ NotAccepted
Mined but not accepted.
Definition
transactionrecord.h:34
TransactionStatus::Conflicted
@ Conflicted
Conflicts with other transaction or mempool.
Definition
transactionrecord.h:30
TransactionStatus::Abandoned
@ Abandoned
Abandoned from the wallet.
Definition
transactionrecord.h:31
TransactionStatus::depth
qint64 depth
Definition
transactionrecord.h:50
TransactionStatus::needsUpdate
bool needsUpdate
Definition
transactionrecord.h:56
TransactionStatus::sortKey
std::string sortKey
Sorting key based on status.
Definition
transactionrecord.h:40
interfaces::WalletTx
Definition
wallet.h:382
interfaces::WalletTxStatus
Updated transaction status.
Definition
wallet.h:401
transaction_identifier.h
Txid
transaction_identifier< false > Txid
Txid commits to all transaction fields except the witness.
Definition
transaction_identifier.h:71
uint256.h
Generated on
for Bitcoin Core by
1.17.0