PRCYCoin  2.0.0.7rc1
P2P Digital Currency
walletmodeltransaction.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
6 
7 #include "wallet/wallet.h"
8 
9 WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient>& recipients) : recipients(recipients),
10  walletTransaction(0),
11  keyChange(0),
12  fee(0)
13 {
15 }
16 
18 {
19  delete keyChange;
20  delete walletTransaction;
21 }
22 
23 QList<SendCoinsRecipient> WalletModelTransaction::getRecipients()
24 {
25  return recipients;
26 }
27 
29 {
30  return walletTransaction;
31 }
32 
34 {
35  return (!walletTransaction ? 0 : (::GetSerializeSize(*(CTransaction*)walletTransaction, SER_NETWORK, PROTOCOL_VERSION)));
36 }
37 
39 {
40  return fee;
41 }
42 
44 {
45  fee = newFee;
46 }
47 
49 {
50  CAmount totalTransactionAmount = 0;
51  Q_FOREACH (const SendCoinsRecipient& rcp, recipients) {
52  totalTransactionAmount += rcp.amount;
53  }
54  return totalTransactionAmount;
55 }
56 
58 {
59  keyChange = new CReserveKey(wallet);
60 }
61 
63 {
64  return keyChange;
65 }
SendCoinsRecipient::amount
CAmount amount
Definition: walletmodel.h:61
WalletModelTransaction::newPossibleKeyChange
void newPossibleKeyChange(CWallet *wallet)
Definition: walletmodeltransaction.cpp:57
CReserveKey
A key allocated from the key pool.
Definition: wallet.h:679
wallet.h
GetSerializeSize
unsigned int GetSerializeSize(char a, int, int=0)
Definition: serialize.h:194
WalletModelTransaction::getTransactionSize
unsigned int getTransactionSize()
Definition: walletmodeltransaction.cpp:33
SER_NETWORK
@ SER_NETWORK
Definition: serialize.h:159
WalletModelTransaction::getTotalTransactionAmount
CAmount getTotalTransactionAmount()
Definition: walletmodeltransaction.cpp:48
WalletModelTransaction::getTransactionFee
CAmount getTransactionFee()
Definition: walletmodeltransaction.cpp:38
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:269
WalletModelTransaction::WalletModelTransaction
WalletModelTransaction(const QList< SendCoinsRecipient > &recipients)
Definition: walletmodeltransaction.cpp:9
SendCoinsRecipient
Definition: walletmodel.h:46
WalletModelTransaction::setTransactionFee
void setTransactionFee(const CAmount &newFee)
Definition: walletmodeltransaction.cpp:43
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
WalletModelTransaction::fee
CAmount fee
Definition: walletmodeltransaction.h:45
WalletModelTransaction::keyChange
CReserveKey * keyChange
Definition: walletmodeltransaction.h:44
WalletModelTransaction::walletTransaction
CWalletTx * walletTransaction
Definition: walletmodeltransaction.h:43
WalletModelTransaction::getTransaction
CWalletTx * getTransaction()
Definition: walletmodeltransaction.cpp:28
walletmodeltransaction.h
CWallet
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:243
CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:792
WalletModelTransaction::recipients
const QList< SendCoinsRecipient > recipients
Definition: walletmodeltransaction.h:42
WalletModelTransaction::~WalletModelTransaction
~WalletModelTransaction()
Definition: walletmodeltransaction.cpp:17
WalletModelTransaction::getRecipients
QList< SendCoinsRecipient > getRecipients()
Definition: walletmodeltransaction.cpp:23
WalletModelTransaction::getPossibleKeyChange
CReserveKey * getPossibleKeyChange()
Definition: walletmodeltransaction.cpp:62