Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodeltransaction.cpp
// 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. | ||||
#include "walletmodeltransaction.h" | #include "walletmodeltransaction.h" | ||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
#include "wallet/wallet.h" | #include "wallet/wallet.h" | ||||
WalletModelTransaction::WalletModelTransaction( | WalletModelTransaction::WalletModelTransaction( | ||||
const QList<SendCoinsRecipient> &_recipients) | const QList<SendCoinsRecipient> &_recipients) | ||||
: recipients(_recipients), walletTransaction(0), keyChange(0), fee() { | : recipients(_recipients), walletTransaction(0), fee() { | ||||
walletTransaction = new CWalletTx(); | walletTransaction = new CWalletTx(); | ||||
} | } | ||||
WalletModelTransaction::~WalletModelTransaction() { | WalletModelTransaction::~WalletModelTransaction() { | ||||
delete keyChange; | |||||
delete walletTransaction; | delete walletTransaction; | ||||
} | } | ||||
QList<SendCoinsRecipient> WalletModelTransaction::getRecipients() const { | QList<SendCoinsRecipient> WalletModelTransaction::getRecipients() const { | ||||
return recipients; | return recipients; | ||||
} | } | ||||
CWalletTx *WalletModelTransaction::getTransaction() const { | CWalletTx *WalletModelTransaction::getTransaction() const { | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | Amount WalletModelTransaction::getTotalTransactionAmount() const { | ||||
Amount totalTransactionAmount = Amount::zero(); | Amount totalTransactionAmount = Amount::zero(); | ||||
for (const SendCoinsRecipient &rcp : recipients) { | for (const SendCoinsRecipient &rcp : recipients) { | ||||
totalTransactionAmount += rcp.amount; | totalTransactionAmount += rcp.amount; | ||||
} | } | ||||
return totalTransactionAmount; | return totalTransactionAmount; | ||||
} | } | ||||
void WalletModelTransaction::newPossibleKeyChange(CWallet *wallet) { | void WalletModelTransaction::newPossibleKeyChange(CWallet *wallet) { | ||||
keyChange = new CReserveKey(wallet); | keyChange.reset(new CReserveKey(wallet)); | ||||
} | } | ||||
CReserveKey *WalletModelTransaction::getPossibleKeyChange() { | CReserveKey *WalletModelTransaction::getPossibleKeyChange() { | ||||
return keyChange; | return keyChange.get(); | ||||
} | } |