MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / TxGetChange

Function TxGetChange

src/wallet/receive.cpp:87–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87CAmount TxGetChange(const CWallet& wallet, const CTransaction& tx)
88{
89 LOCK(wallet.cs_wallet);
90 CAmount nChange = 0;
91 for (const CTxOut& txout : tx.vout)
92 {
93 nChange += OutputGetChange(wallet, txout);
94 if (!MoneyRange(nChange))
95 throw std::runtime_error(std::string(__func__) + ": value out of range");
96 }
97 return nChange;
98}
99
100static CAmount GetCachableAmount(const CWallet& wallet, const CWalletTx& wtx, CWalletTx::AmountType type, bool avoid_reuse)
101{

Callers 1

CachedTxGetChangeFunction · 0.85

Calls 2

OutputGetChangeFunction · 0.85
MoneyRangeFunction · 0.85

Tested by

no test coverage detected