Merge #10920: [qt] Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet)
[bitcoinplatinum.git] / src / qt / walletmodeltransaction.h
blob519cf9df996aef5612b043d2c47cba250c448e99
1 // Copyright (c) 2011-2014 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.
5 #ifndef BITCOIN_QT_WALLETMODELTRANSACTION_H
6 #define BITCOIN_QT_WALLETMODELTRANSACTION_H
8 #include <qt/walletmodel.h>
10 #include <QObject>
12 class SendCoinsRecipient;
14 class CReserveKey;
15 class CWallet;
16 class CWalletTx;
18 /** Data model for a walletmodel transaction. */
19 class WalletModelTransaction
21 public:
22 explicit WalletModelTransaction(const QList<SendCoinsRecipient> &recipients);
23 ~WalletModelTransaction();
25 QList<SendCoinsRecipient> getRecipients() const;
27 CWalletTx *getTransaction() const;
28 unsigned int getTransactionSize();
30 void setTransactionFee(const CAmount& newFee);
31 CAmount getTransactionFee() const;
33 CAmount getTotalTransactionAmount() const;
35 void newPossibleKeyChange(CWallet *wallet);
36 CReserveKey *getPossibleKeyChange();
38 void reassignAmounts(int nChangePosRet); // needed for the subtract-fee-from-amount feature
40 private:
41 QList<SendCoinsRecipient> recipients;
42 CWalletTx *walletTransaction;
43 std::unique_ptr<CReserveKey> keyChange;
44 CAmount fee;
47 #endif // BITCOIN_QT_WALLETMODELTRANSACTION_H