slight optimizations/readability improvements for ds

This commit is contained in:
UdjinM6 2015-06-24 19:30:05 +03:00
parent 451a98732e
commit a4bb283367

View File

@ -1485,18 +1485,16 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
} }
if(fDryRun) return true;
nOnlyDenominatedBalance = pwalletMain->GetDenominatedBalance(true, false, false); nOnlyDenominatedBalance = pwalletMain->GetDenominatedBalance(true, false, false);
nBalanceNeedsDenominated = nBalanceNeedsAnonymized - nOnlyDenominatedBalance; nBalanceNeedsDenominated = nBalanceNeedsAnonymized - nOnlyDenominatedBalance;
if(!fDryRun && nBalanceNeedsDenominated > nOnlyDenominatedBalance) return CreateDenominated(nBalanceNeedsDenominated); //check if we have should create more denominated inputs
if(nBalanceNeedsDenominated > nOnlyDenominatedBalance) return CreateDenominated(nBalanceNeedsDenominated);
//check to see if we have the collateral sized inputs, it requires these //check if we have the collateral sized inputs
if(!pwalletMain->HasCollateralInputs()){ if(!pwalletMain->HasCollateralInputs()) return MakeCollateralAmounts();
if(!fDryRun) MakeCollateralAmounts();
return true;
}
if(fDryRun) return true;
std::vector<CTxOut> vOut; std::vector<CTxOut> vOut;
@ -1755,14 +1753,16 @@ bool CDarksendPool::MakeCollateralAmounts()
reservekeyCollateral.KeepKey(); reservekeyCollateral.KeepKey();
// use the same cachedLastSuccess as for DS mixinx to prevent race
if(pwalletMain->CommitTransaction(wtx, reservekeyChange))
cachedLastSuccess = chainActive.Tip()->nHeight;
else
LogPrintf("MakeCollateralAmounts: CommitTransaction failed!\n");
LogPrintf("MakeCollateralAmounts: tx %s\n", wtx.GetHash().GetHex()); LogPrintf("MakeCollateralAmounts: tx %s\n", wtx.GetHash().GetHex());
// use the same cachedLastSuccess as for DS mixinx to prevent race
if(!pwalletMain->CommitTransaction(wtx, reservekeyChange)) {
LogPrintf("MakeCollateralAmounts: CommitTransaction failed!\n");
return false;
}
cachedLastSuccess = chainActive.Tip()->nHeight;
return true; return true;
} }