MCPcopy Create free account
hub / github.com/LUX-Core/lux / SelectCoinsCollateral

Method SelectCoinsCollateral

src/wallet.cpp:2609–2634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2607}
2608
2609bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const
2610{
2611 vector<COutput> vCoins;
2612
2613 //LogPrintf(" selecting coins for collateral\n");
2614 AvailableCoins(vCoins);
2615
2616 //LogPrintf("found coins %d\n", (int)vCoins.size());
2617
2618 set<pair<const CWalletTx*, unsigned int> > setCoinsRet2;
2619
2620 for (const COutput& out : vCoins) {
2621 // collateral inputs will always be a multiple of DARSEND_COLLATERAL, up to five
2622 if (IsCollateralAmount(out.tx->vout[out.i].nValue)) {
2623 CTxIn vin = CTxIn(out.tx->GetHash(), out.i);
2624
2625 vin.prevPubKey = out.tx->vout[out.i].scriptPubKey; // the inputs PubKey
2626 nValueRet += out.tx->vout[out.i].nValue;
2627 setCoinsRet.push_back(vin);
2628 setCoinsRet2.insert(make_pair(out.tx, out.i));
2629 return true;
2630 }
2631 }
2632
2633 return false;
2634}
2635
2636int CWallet::CountInputsWithAmount(int64_t nInputAmount)
2637{

Callers

nothing calls this directly

Calls 4

CTxInClass · 0.70
GetHashMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected