fix MakeCollateralAmounts stuck sometimes and wouldn't let denominating further

This commit is contained in:
UdjinM6 2015-02-07 05:18:37 +03:00
parent 3a72da77ac
commit fd7992dc61

View File

@ -1682,14 +1682,8 @@ bool CDarkSendPool::SendRandomPaymentToSelf()
// Split up large inputs or create fee sized inputs
bool CDarkSendPool::MakeCollateralAmounts()
{
// should split up to remaining amount only...
int64_t nTotalBalance = pwalletMain->GetBalance();
int64_t nSplitBalance = nAnonymizeDarkcoinAmount*COIN - pwalletMain->GetDenominatedBalance();
if(nSplitBalance > nTotalBalance) nSplitBalance = nTotalBalance;
int64_t nTotalOut = 0;
LogPrintf("DoAutomaticDenominating: MakeCollateralAmounts: nSplitBalance %d nTotalBalance %d\n", nSplitBalance, pwalletMain->GetDenominatedBalance(false));
// make our change address
CReserveKey reservekey(pwalletMain);
@ -1708,11 +1702,6 @@ bool CDarkSendPool::MakeCollateralAmounts()
vecSend.push_back(make_pair(scriptChange, (DARKSEND_COLLATERAL*2)+DARKSEND_FEE));
nTotalOut += (DARKSEND_COLLATERAL*2)+DARKSEND_FEE;
if(nTotalOut > nSplitBalance) {
LogPrintf("MakeCollateralAmounts: Not enough balance to split\n");
return false;
}
CCoinControl *coinControl=NULL;
// try to use non-denominated and not mn-like funds
bool success = pwalletMain->CreateTransaction(vecSend, wtx, reservekey,