| 1636 | } |
| 1637 | |
| 1638 | bool CDarkSendPool::SendRandomPaymentToSelf() { |
| 1639 | int64_t nBalance = pwalletMain->GetBalance(); |
| 1640 | int64_t nPayment = (nBalance * 0.35) + (rand() % nBalance); |
| 1641 | |
| 1642 | if (nPayment > nBalance) nPayment = nBalance - (0.1 * COIN); |
| 1643 | |
| 1644 | // make our change address |
| 1645 | CReserveKey reservekey(pwalletMain); |
| 1646 | |
| 1647 | CScript scriptDenom; |
| 1648 | CPubKey vchPubKey; |
| 1649 | assert(reservekey.GetReservedKey(vchPubKey, false)); // should never fail, as we just unlocked |
| 1650 | scriptDenom = GetScriptForDestination(vchPubKey.GetID()); |
| 1651 | |
| 1652 | CWalletTx wtx; |
| 1653 | int64_t nFeeRet = 0; |
| 1654 | std::string strFail = ""; |
| 1655 | std::vector<CRecipient> vecSend; |
| 1656 | |
| 1657 | // ****** Add fees ************ / |
| 1658 | CRecipient recipient = {scriptDenom, nPayment, false}; |
| 1659 | vecSend.push_back(recipient); |
| 1660 | |
| 1661 | CCoinControl* coinControl = NULL; |
| 1662 | int nChangePos = -1; |
| 1663 | //int32_t nChangePos; |
| 1664 | //bool success = pwalletMain->CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePos, strFail, coinControl, ONLY_DENOMINATED); |
| 1665 | bool success = pwalletMain->CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePos, strFail, coinControl, ONLY_DENOMINATED); |
| 1666 | if (!success) { |
| 1667 | LogPrintf("SendRandomPaymentToSelf: Error - %s\n", strFail.c_str()); |
| 1668 | return false; |
| 1669 | } |
| 1670 | |
| 1671 | pwalletMain->CommitTransaction(wtx, reservekey); |
| 1672 | |
| 1673 | LogPrintf("SendRandomPaymentToSelf Success: tx %s\n", wtx.GetHash().GetHex().c_str()); |
| 1674 | |
| 1675 | return true; |
| 1676 | } |
| 1677 | |
| 1678 | // Split up large inputs or create fee sized inputs |
| 1679 | bool CDarkSendPool::MakeCollateralAmounts() { |
no test coverage detected