| 66 | } |
| 67 | |
| 68 | CAmountMap TxGetCredit(const CWallet& wallet, const CWalletTx& wtx, const isminefilter& filter) { |
| 69 | CAmountMap nCredit; |
| 70 | { |
| 71 | LOCK(wallet.cs_wallet); |
| 72 | |
| 73 | CAsset pegged_asset{Params().GetConsensus().pegged_asset}; |
| 74 | for (unsigned int i = 0; i < wtx.tx->vout.size(); ++i) { |
| 75 | if (wallet.IsMine(wtx.tx->vout[i]) & filter) { |
| 76 | CAsset asset{wtx.GetOutputAsset(wallet, i)}; |
| 77 | CAmount credit = std::max<CAmount>(0, wtx.GetOutputValueOut(wallet, i)); |
| 78 | if (asset == pegged_asset && !MoneyRange(credit)) { |
| 79 | throw std::runtime_error(std::string(__func__) + ": value out of range"); |
| 80 | } |
| 81 | |
| 82 | nCredit[asset] += credit; |
| 83 | if (!MoneyRange(nCredit, pegged_asset)) |
| 84 | throw std::runtime_error(std::string(__func__) + ": value out of range"); |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | return nCredit; |
| 89 | } |
| 90 | |
| 91 | CAmountMap GetChange(const CWallet& wallet, const CWalletTx& wtx) { |
| 92 | CAmountMap nChange; |
no test coverage detected