Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
qt
walletmodeltransaction.cpp
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
#include <
qt/walletmodeltransaction.h
>
6
7
#include <
policy/policy.h
>
8
9
WalletModelTransaction::WalletModelTransaction
(
const
QList<SendCoinsRecipient>& _recipients)
10
:
recipients
(_recipients)
11
{
12
}
13
14
QList<SendCoinsRecipient>
WalletModelTransaction::getRecipients
()
const
15
{
16
return
recipients
;
17
}
18
19
CTransactionRef
&
WalletModelTransaction::getWtx
()
20
{
21
return
wtx
;
22
}
23
24
void
WalletModelTransaction::setWtx
(
const
CTransactionRef
& newTx)
25
{
26
wtx
= newTx;
27
}
28
29
unsigned
int
WalletModelTransaction::getTransactionSize
()
30
{
31
return
wtx
?
GetVirtualTransactionSize
(*
wtx
) : 0;
32
}
33
34
CAmount
WalletModelTransaction::getTransactionFee
()
const
35
{
36
return
fee
;
37
}
38
39
void
WalletModelTransaction::setTransactionFee
(
const
CAmount
& newFee)
40
{
41
fee
= newFee;
42
}
43
44
void
WalletModelTransaction::reassignAmounts
(
int
nChangePosRet)
45
{
46
const
CTransaction
* walletTransaction =
wtx
.get();
47
int
i = 0;
48
for
(QList<SendCoinsRecipient>::iterator it =
recipients
.begin(); it !=
recipients
.end(); ++it)
49
{
50
SendCoinsRecipient
& rcp = (*it);
51
{
52
if
(i == nChangePosRet)
53
i++;
54
rcp.
amount
= walletTransaction->
vout
[i].nValue;
55
i++;
56
}
57
}
58
}
59
60
CAmount
WalletModelTransaction::getTotalTransactionAmount
()
const
61
{
62
CAmount
totalTransactionAmount = 0;
63
for
(
const
SendCoinsRecipient
&rcp :
recipients
)
64
{
65
totalTransactionAmount += rcp.amount;
66
}
67
return
totalTransactionAmount;
68
}
CAmount
int64_t CAmount
Amount in satoshis (Can be negative).
Definition
amount.h:12
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition
transaction.h:281
CTransaction::vout
const std::vector< CTxOut > vout
Definition
transaction.h:292
SendCoinsRecipient
Definition
sendcoinsrecipient.h:16
SendCoinsRecipient::amount
CAmount amount
Definition
sendcoinsrecipient.h:29
WalletModelTransaction::setTransactionFee
void setTransactionFee(const CAmount &newFee)
Definition
walletmodeltransaction.cpp:39
WalletModelTransaction::reassignAmounts
void reassignAmounts(int nChangePosRet)
Definition
walletmodeltransaction.cpp:44
WalletModelTransaction::setWtx
void setWtx(const CTransactionRef &)
Definition
walletmodeltransaction.cpp:24
WalletModelTransaction::getRecipients
QList< SendCoinsRecipient > getRecipients() const
Definition
walletmodeltransaction.cpp:14
WalletModelTransaction::recipients
QList< SendCoinsRecipient > recipients
Definition
walletmodeltransaction.h:42
WalletModelTransaction::getTransactionSize
unsigned int getTransactionSize()
Definition
walletmodeltransaction.cpp:29
WalletModelTransaction::fee
CAmount fee
Definition
walletmodeltransaction.h:44
WalletModelTransaction::getWtx
CTransactionRef & getWtx()
Definition
walletmodeltransaction.cpp:19
WalletModelTransaction::WalletModelTransaction
WalletModelTransaction(const QList< SendCoinsRecipient > &recipients)
Definition
walletmodeltransaction.cpp:9
WalletModelTransaction::getTransactionFee
CAmount getTransactionFee() const
Definition
walletmodeltransaction.cpp:34
WalletModelTransaction::wtx
CTransactionRef wtx
Definition
walletmodeltransaction.h:43
WalletModelTransaction::getTotalTransactionAmount
CAmount getTotalTransactionAmount() const
Definition
walletmodeltransaction.cpp:60
GetVirtualTransactionSize
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
Definition
policy.cpp:381
policy.h
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition
transaction.h:403
walletmodeltransaction.h
Generated on
for Bitcoin Core by
1.17.0