diff --git a/src/darksend.cpp b/src/darksend.cpp index 5cf6c55ef..3a5977e9e 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -1976,7 +1976,7 @@ int CDarkSendPool::GetDenominationsByAmounts(std::vector& vecAmount){ return GetDenominations(vout1); } -int CDarkSendPool::GetDenominationsByAmount(int64_t nAmount){ +int CDarkSendPool::GetDenominationsByAmount(int64_t nAmount, int nDenomTarget){ CScript e = CScript(); int64_t nValueLeft = nAmount; @@ -1984,6 +1984,15 @@ int CDarkSendPool::GetDenominationsByAmount(int64_t nAmount){ // Make outputs by looping through denominations, from small to large BOOST_REVERSE_FOREACH(int64_t v, darkSendDenominations){ + if(nDenomTarget != 0){ + bool fAccepted = false; + if((nDenomTarget & (1 << 0)) && v == ((100*COIN)+1)) {fAccepted = true;} + else if((nDenomTarget & (1 << 1)) && v == ((10*COIN)+1)) {fAccepted = true;} + else if((nDenomTarget & (1 << 2)) && v == ((1*COIN)+1)) {fAccepted = true;} + else if((nDenomTarget & (1 << 3)) && v == ((.1*COIN)+1)) {fAccepted = true;} + if(!fAccepted) continue; + } + int nOutputs = 0; if(std::find(vecDisabledDenominations.begin(), vecDisabledDenominations.end(), v) != vecDisabledDenominations.end()) diff --git a/src/darksend.h b/src/darksend.h index 3821857f3..6b7a5ade0 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -431,7 +431,8 @@ public: int GetDenominations(const std::vector& vout); void GetDenominationsToString(int nDenom, std::string& strDenom); // get the denominations for a specific amount of darkcoin. - int GetDenominationsByAmount(int64_t nAmount); + int GetDenominationsByAmount(int64_t nAmount, int nDenomTarget=0); + int GetDenominationsByAmounts(std::vector& vecAmount); }; diff --git a/src/wallet.cpp b/src/wallet.cpp index 6139b3dde..7ff8b0046 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1452,6 +1452,16 @@ struct CompareByPriority bool CWallet::SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t nValueMax, std::vector& setCoinsRet, int64_t& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax) { + //if the forth bit is on, it doesn't matter which inputs we chose + if(nDenom & (1 << 4)) { + if(SelectCoinsDark(nValueMin, nValueMax, setCoinsRet, nValueRet, nDarksendRoundsMin, nDarksendRoundsMax)){ + int64_t nTotalValue = GetTotalValue(setCoinsRet); + return nDenom == darkSendPool.GetDenominationsByAmount(nTotalValue, nDenom); + } else { + return false; + } + } + CCoinControl *coinControl=NULL; setCoinsRet.clear();