mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 19:47:30 -03:00
b7f6a89a3e
7b7cd11244
clang-tidy, qt: Force checks for headers in `src/qt` (Hennadii Stepanov)69eacf2c5e
clang-tidy, qt: Fix `modernize-use-default-member-init` in headers (Hennadii Stepanov) Pull request description: This PR split from bitcoin/bitcoin#26705 and contains only changes in `src/qt`. Effectively, it fixes the clang-tidy's `modernize-use-default-member-init` errors, and forces clang-tidy checks for all headers in the `src/qt` directory. ACKs for top commit: jarolrod: ACK7b7cd11244
Tree-SHA512: 79525bb0f31ae7cad88c781e55091a21467c0485ddc1ed03ad62e051480fda3b3710619ea11af480437edba3c6e038f7c40edc6b373e3a37408c006d11b34686
72 lines
1.7 KiB
C++
72 lines
1.7 KiB
C++
// Copyright (c) 2011-2021 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config/bitcoin-config.h>
|
|
#endif
|
|
|
|
#include <qt/walletmodeltransaction.h>
|
|
|
|
#include <policy/policy.h>
|
|
|
|
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient>& _recipients)
|
|
: recipients(_recipients)
|
|
{
|
|
}
|
|
|
|
QList<SendCoinsRecipient> WalletModelTransaction::getRecipients() const
|
|
{
|
|
return recipients;
|
|
}
|
|
|
|
CTransactionRef& WalletModelTransaction::getWtx()
|
|
{
|
|
return wtx;
|
|
}
|
|
|
|
void WalletModelTransaction::setWtx(const CTransactionRef& newTx)
|
|
{
|
|
wtx = newTx;
|
|
}
|
|
|
|
unsigned int WalletModelTransaction::getTransactionSize()
|
|
{
|
|
return wtx ? GetVirtualTransactionSize(*wtx) : 0;
|
|
}
|
|
|
|
CAmount WalletModelTransaction::getTransactionFee() const
|
|
{
|
|
return fee;
|
|
}
|
|
|
|
void WalletModelTransaction::setTransactionFee(const CAmount& newFee)
|
|
{
|
|
fee = newFee;
|
|
}
|
|
|
|
void WalletModelTransaction::reassignAmounts(int nChangePosRet)
|
|
{
|
|
const CTransaction* walletTransaction = wtx.get();
|
|
int i = 0;
|
|
for (QList<SendCoinsRecipient>::iterator it = recipients.begin(); it != recipients.end(); ++it)
|
|
{
|
|
SendCoinsRecipient& rcp = (*it);
|
|
{
|
|
if (i == nChangePosRet)
|
|
i++;
|
|
rcp.amount = walletTransaction->vout[i].nValue;
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
CAmount WalletModelTransaction::getTotalTransactionAmount() const
|
|
{
|
|
CAmount totalTransactionAmount = 0;
|
|
for (const SendCoinsRecipient &rcp : recipients)
|
|
{
|
|
totalTransactionAmount += rcp.amount;
|
|
}
|
|
return totalTransactionAmount;
|
|
}
|