mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
removed ability to denominate specific amounts
This commit is contained in:
parent
06365bca58
commit
d9e7cad963
12
src/main.cpp
12
src/main.cpp
@ -7012,18 +7012,12 @@ void CDarkSendPool::DoAutomaticDenominating()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int64 amount = pwalletMain->GetBalance();
|
||||
if(amount > 999*COIN) amount = (999*COIN);
|
||||
amount -= amount/10;
|
||||
amount = roundUp64(amount, COIN/100);
|
||||
|
||||
std::string strError = pwalletMain->DarkSendDenominate(amount);
|
||||
printf("DoAutomaticDenominating : Running darksend denominate for %"PRI64d" coins. Return '%s'\n", nValueIn/COIN, strError.c_str());
|
||||
std::string strError = pwalletMain->DarkSendDenominate();
|
||||
printf("DoAutomaticDenominating : Running darksend denominate. Return '%s'\n", strError.c_str());
|
||||
|
||||
if(strError == "") return;
|
||||
|
||||
if(strError == "Error: Darksend requires a collateral transaction and could not locate an acceptable input!" || strError == "Insufficient funds 2") {
|
||||
if(strError == "Error: Darksend requires a collateral transaction and could not locate an acceptable input!" || strError == "Insufficient funds") {
|
||||
SplitUpMoney();
|
||||
} else {
|
||||
printf("DoAutomaticDenominating : Error running denominate, %s\n", strError.c_str());
|
||||
|
@ -15,7 +15,7 @@ using namespace std;
|
||||
|
||||
Value darksend(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp)
|
||||
if (fHelp || params.size() == 0)
|
||||
throw runtime_error(
|
||||
"darksend <darkcoinaddress> <amount>\n"
|
||||
"darkcoinaddress, denominate, or auto (AutoDenominate)"
|
||||
@ -44,17 +44,6 @@ Value darksend(const Array& params, bool fHelp)
|
||||
if (!address.IsValid() && params[0].get_str() != "denominate")
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid DarkCoin address");
|
||||
|
||||
if(params[0].get_str() == "denominate"){
|
||||
// Amount
|
||||
int64 nAmount = AmountFromValue(params[1]);
|
||||
|
||||
string strError = pwalletMain->DarkSendDenominate(nAmount);
|
||||
if (strError != "")
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, strError);
|
||||
|
||||
return darkSendPool.lastMessage;
|
||||
}
|
||||
|
||||
// Amount
|
||||
int64 nAmount = AmountFromValue(params[1]);
|
||||
|
||||
|
@ -1641,15 +1641,9 @@ string CWallet::SendMoneyToDestination(const CTxDestination& address, int64 nVal
|
||||
return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee, coin_type);
|
||||
}
|
||||
|
||||
string CWallet::DarkSendDenominate(int64 nValue)
|
||||
string CWallet::DarkSendDenominate()
|
||||
{
|
||||
|
||||
// Check amount
|
||||
if (nValue <= 0)
|
||||
return _("Invalid amount");
|
||||
if (nValue + nTransactionFee > GetBalance())
|
||||
return _("Insufficient funds 1");
|
||||
|
||||
if (IsLocked())
|
||||
{
|
||||
return _("Error: Wallet locked, unable to create transaction!");
|
||||
@ -1658,39 +1652,24 @@ string CWallet::DarkSendDenominate(int64 nValue)
|
||||
CReserveKey reservekey(this);
|
||||
CTransaction txCollateral;
|
||||
|
||||
//**************
|
||||
|
||||
int64 nFeeRet = 0.001*COIN; ///need to get a better fee calc
|
||||
int64 nTotalValue = nValue + nFeeRet+ nFeeRet;
|
||||
|
||||
int64 amount = roundUp64(nValue, COIN/100);
|
||||
|
||||
if(nValue != amount){
|
||||
return _("DarkSend can't send amounts more precise than XXXX.XX DRK.");
|
||||
}
|
||||
|
||||
if(amount > 999.99*COIN){
|
||||
return _("DarkSend can't send amounts more than 999.99DRK");
|
||||
}
|
||||
|
||||
amount = roundUp64(nTotalValue, COIN/100);
|
||||
|
||||
// ** find the coins we'll use
|
||||
std::vector<CTxIn> vCoins;
|
||||
int64 nValueIn = 0;
|
||||
|
||||
//try to use denominated funds (for added anonymity)
|
||||
if (!SelectCoinsDark(nTotalValue, 1000*COIN, vCoins, nValueIn, -2, nDarksendRounds))
|
||||
if (!SelectCoinsDark(1*COIN, 1000*COIN, vCoins, nValueIn, -2, nDarksendRounds))
|
||||
{
|
||||
vCoins.clear();
|
||||
return _("Insufficient funds 2");
|
||||
return _("Insufficient funds");
|
||||
}
|
||||
|
||||
//printf(" --- nValueIn %"PRI64d" nTotalValue %"PRI64d"\n", nValueIn, nTotalValue);
|
||||
|
||||
// calculate total value out --------
|
||||
|
||||
nTotalValue = 0;
|
||||
int64 nTotalValue = 0;
|
||||
CWalletTx wtx;
|
||||
BOOST_FOREACH(CTxIn i, vCoins){
|
||||
if (mapWallet.count(i.prevout.hash))
|
||||
|
@ -204,7 +204,7 @@ public:
|
||||
std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false, AvailableCoinsType coin_type=ALL_COINS);
|
||||
std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false, AvailableCoinsType coin_type=ALL_COINS);
|
||||
std::string DarkSendMoney(const CTxDestination &address, int64 nValue);
|
||||
std::string DarkSendDenominate(int64 nValue);
|
||||
std::string DarkSendDenominate();
|
||||
|
||||
bool NewKeyPool();
|
||||
bool TopUpKeyPool();
|
||||
|
Loading…
Reference in New Issue
Block a user