Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2011-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <qt/walletmodeltransaction.h>7#include <policy/policy.h>9WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient>& _recipients)10: recipients(_recipients)11{12}14QList<SendCoinsRecipient> WalletModelTransaction::getRecipients() const15{16return recipients;17}19CTransactionRef& WalletModelTransaction::getWtx()20{21return wtx;22}24void WalletModelTransaction::setWtx(const CTransactionRef& newTx)25{26wtx = newTx;27}29unsigned int WalletModelTransaction::getTransactionSize()30{31return wtx ? GetVirtualTransactionSize(*wtx) : 0;32}34CAmount WalletModelTransaction::getTransactionFee() const35{36return fee;37}39void WalletModelTransaction::setTransactionFee(const CAmount& newFee)40{41fee = newFee;42}44void WalletModelTransaction::reassignAmounts(int nChangePosRet)45{46const CTransaction* walletTransaction = wtx.get();47int i = 0;48for (QList<SendCoinsRecipient>::iterator it = recipients.begin(); it != recipients.end(); ++it)49{50SendCoinsRecipient& rcp = (*it);51{52if (i == nChangePosRet)53i++;54rcp.amount = walletTransaction->vout[i].nValue;55i++;56}57}58}60CAmount WalletModelTransaction::getTotalTransactionAmount() const61{62CAmount totalTransactionAmount = 0;63for (const SendCoinsRecipient &rcp : recipients)64{65totalTransactionAmount += rcp.amount;66}67return totalTransactionAmount;68}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.