| 2607 | } |
| 2608 | |
| 2609 | bool 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 | |
| 2636 | int CWallet::CountInputsWithAmount(int64_t nInputAmount) |
| 2637 | { |