15 std::map<uint256, CWalletTx>::const_iterator mi =
wallet.mapWallet.find(txin.
prevout.
hash);
16 if (mi !=
wallet.mapWallet.end())
32 if (mi ==
wallet.mapWallet.end())
49 throw std::runtime_error(std::string(__func__) +
": value out of range");
51 return ((
wallet.IsMine(txout) & filter) ? txout.
nValue : 0);
61 throw std::runtime_error(std::string(__func__) +
": value out of range");
81 if (!
wallet.FindAddressBookEntry(address)) {
97 throw std::runtime_error(std::string(__func__) +
": value out of range");
109 throw std::runtime_error(std::string(__func__) +
": value out of range");
117 if (recalculate || !amount.m_cached[filter]) {
121 return amount.m_value[filter];
127 if (
wallet.IsTxImmatureCoinBase(wtx))
143 if (wtx.
tx->vin.empty())
167 if (
wallet.IsTxImmatureCoinBase(wtx) &&
wallet.IsTxInMainChain(wtx)) {
176 if (
wallet.IsTxImmatureCoinBase(wtx) &&
wallet.IsTxInMainChain(wtx)) {
189 if (
wallet.IsTxImmatureCoinBase(wtx))
199 for (
unsigned int i = 0; i < wtx.
tx->vout.size(); i++)
201 if (!
wallet.IsSpent(hashTx, i) && (allow_used_addresses || !
wallet.IsSpentKey(hashTx, i))) {
202 const CTxOut &txout = wtx.
tx->vout[i];
205 throw std::runtime_error(std::string(__func__) +
" : value out of range");
218 std::list<COutputEntry>& listReceived,
222 listReceived.clear();
229 CAmount nValueOut = wtx.
tx->GetValueOut();
230 nFee = nDebit - nValueOut;
235 for (
unsigned int i = 0; i < wtx.
tx->vout.size(); ++i)
237 const CTxOut& txout = wtx.
tx->vout[i];
248 else if (!(fIsMine & filter))
256 wallet.WalletLogPrintf(
"CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",
265 listSent.push_back(output);
268 if (fIsMine & filter)
269 listReceived.push_back(output);
282 int nDepth =
wallet.GetTxDepthInMainChain(wtx);
283 if (nDepth >= 1)
return true;
284 if (nDepth < 0)
return false;
292 for (
const CTxIn& txin : wtx.
tx->vin)
296 if (parent ==
nullptr)
return false;
301 if (trusted_parents.count(parent->
GetHash()))
continue;
304 trusted_parents.insert(parent->
GetHash());
311 std::set<uint256> trusted_parents;
322 std::set<uint256> trusted_parents;
323 for (
const auto& entry :
wallet.mapWallet)
327 const int tx_depth{
wallet.GetTxDepthInMainChain(wtx)};
330 if (is_trusted && tx_depth >= min_depth) {
334 if (!is_trusted && tx_depth == 0 && wtx.
InMempool()) {
347 std::map<CTxDestination, CAmount> balances;
351 std::set<uint256> trusted_parents;
352 for (
const auto& walletEntry :
wallet.mapWallet)
354 const CWalletTx& wtx = walletEntry.second;
359 if (
wallet.IsTxImmatureCoinBase(wtx))
362 int nDepth =
wallet.GetTxDepthInMainChain(wtx);
366 for (
unsigned int i = 0; i < wtx.
tx->vout.size(); i++)
369 if (!
wallet.IsMine(wtx.
tx->vout[i]))
374 CAmount n =
wallet.IsSpent(walletEntry.first, i) ? 0 : wtx.
tx->vout[i].nValue;
386 std::set< std::set<CTxDestination> > groupings;
387 std::set<CTxDestination> grouping;
389 for (
const auto& walletEntry :
wallet.mapWallet)
391 const CWalletTx& wtx = walletEntry.second;
393 if (wtx.
tx->vin.size() > 0)
395 bool any_mine =
false;
397 for (
const CTxIn& txin : wtx.
tx->vin)
404 grouping.insert(address);
411 for (
const CTxOut& txout : wtx.
tx->vout)
417 grouping.insert(txoutAddr);
420 if (grouping.size() > 0)
422 groupings.insert(grouping);
428 for (
const auto& txout : wtx.
tx->vout)
434 grouping.insert(address);
435 groupings.insert(grouping);
440 std::set< std::set<CTxDestination>* > uniqueGroupings;
441 std::map< CTxDestination, std::set<CTxDestination>* > setmap;
442 for (std::set<CTxDestination> _grouping : groupings)
445 std::set< std::set<CTxDestination>* > hits;
446 std::map< CTxDestination, std::set<CTxDestination>* >::iterator it;
448 if ((it = setmap.find(address)) != setmap.end())
449 hits.insert((*it).second);
452 std::set<CTxDestination>* merged =
new std::set<CTxDestination>(_grouping);
453 for (std::set<CTxDestination>* hit : hits)
455 merged->insert(hit->begin(), hit->end());
456 uniqueGroupings.erase(hit);
459 uniqueGroupings.insert(merged);
463 setmap[element] = merged;
466 std::set< std::set<CTxDestination> > ret;
467 for (
const std::set<CTxDestination>* uniqueGrouping : uniqueGroupings)
469 ret.insert(*uniqueGrouping);
470 delete uniqueGrouping;