mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
clear out DS fee
This commit is contained in:
parent
ecd37e134e
commit
55faae269c
@ -16,7 +16,6 @@
|
||||
#define START_MASTERNODE_PAYMENTS 1403728576 //Wed, 25 Jun 2014 20:36:16 GMT
|
||||
|
||||
static const int64_t DARKSEND_COLLATERAL = (0.01*COIN);
|
||||
static const int64_t DARKSEND_FEE = (0.0125*COIN);
|
||||
static const int64_t DARKSEND_POOL_MAX = (999.99*COIN);
|
||||
|
||||
/*
|
||||
|
@ -1011,7 +1011,7 @@ bool CDarkSendPool::IsCollateralValid(const CTransaction& txCollateral){
|
||||
}
|
||||
|
||||
//collateral transactions are required to pay out DARKSEND_COLLATERAL as a fee to the miners
|
||||
if(nValueIn-nValueOut < DARKSEND_COLLATERAL) {
|
||||
if(nValueIn - nValueOut < DARKSEND_COLLATERAL) {
|
||||
if(fDebug) LogPrintf ("CDarkSendPool::IsCollateralValid - did not include enough fees in transaction %d\n%s\n", nValueOut-nValueIn, txCollateral.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
@ -1438,13 +1438,13 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
|
||||
int64_t nValueMin = CENT;
|
||||
int64_t nValueIn = 0;
|
||||
|
||||
// should not be less than fees in DARKSEND_FEE + few (lets say 5) smallest denoms
|
||||
int64_t nLowestDenom = DARKSEND_FEE + darkSendDenominations[darkSendDenominations.size() - 1]*5;
|
||||
// should not be less than fees in DARKSEND_COLLATERAL + few (lets say 5) smallest denoms
|
||||
int64_t nLowestDenom = DARKSEND_COLLATERAL + darkSendDenominations[darkSendDenominations.size() - 1]*5;
|
||||
|
||||
// if there are no DS collateral inputs yet
|
||||
if(!pwalletMain->HasCollateralInputs())
|
||||
// should have some additional amount for them
|
||||
nLowestDenom += (DARKSEND_COLLATERAL*4)+DARKSEND_FEE*2;
|
||||
nLowestDenom += DARKSEND_COLLATERAL*4;
|
||||
|
||||
int64_t nBalanceNeedsAnonymized = nAnonymizeDarkcoinAmount*COIN - pwalletMain->GetAnonymizedBalance();
|
||||
|
||||
@ -1718,8 +1718,7 @@ bool CDarkSendPool::MakeCollateralAmounts()
|
||||
std::string strFail = "";
|
||||
vector< pair<CScript, int64_t> > vecSend;
|
||||
|
||||
vecSend.push_back(make_pair(scriptChange, (DARKSEND_COLLATERAL*2)+DARKSEND_FEE));
|
||||
vecSend.push_back(make_pair(scriptChange, (DARKSEND_COLLATERAL*2)+DARKSEND_FEE));
|
||||
vecSend.push_back(make_pair(scriptChange, DARKSEND_COLLATERAL*4));
|
||||
|
||||
CCoinControl *coinControl=NULL;
|
||||
// try to use non-denominated and not mn-like funds
|
||||
@ -1764,10 +1763,8 @@ bool CDarkSendPool::CreateDenominated(int64_t nTotalValue)
|
||||
|
||||
// ****** Add collateral outputs ************ /
|
||||
if(!pwalletMain->HasCollateralInputs()) {
|
||||
vecSend.push_back(make_pair(scriptChange, (DARKSEND_COLLATERAL*2)+DARKSEND_FEE));
|
||||
nValueLeft -= (DARKSEND_COLLATERAL*2)+DARKSEND_FEE;
|
||||
vecSend.push_back(make_pair(scriptChange, (DARKSEND_COLLATERAL*2)+DARKSEND_FEE));
|
||||
nValueLeft -= (DARKSEND_COLLATERAL*2)+DARKSEND_FEE;
|
||||
vecSend.push_back(make_pair(scriptChange, DARKSEND_COLLATERAL*4));
|
||||
nValueLeft -= DARKSEND_COLLATERAL*4;
|
||||
}
|
||||
|
||||
// ****** Add denoms ************ /
|
||||
@ -1775,7 +1772,7 @@ bool CDarkSendPool::CreateDenominated(int64_t nTotalValue)
|
||||
int nOutputs = 0;
|
||||
|
||||
// add each output up to 10 times until it can't be added again
|
||||
while(nValueLeft - v >= DARKSEND_FEE && nOutputs <= 10) {
|
||||
while(nValueLeft - v >= DARKSEND_COLLATERAL && nOutputs <= 10) {
|
||||
CScript scriptChange;
|
||||
CPubKey vchPubKey;
|
||||
//use a unique change address
|
||||
|
@ -1626,14 +1626,13 @@ bool CWallet::SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector<
|
||||
|
||||
set<pair<const CWalletTx*,unsigned int> > setCoinsRet2;
|
||||
|
||||
//order the array so fees are first, then denominated money, then the rest.
|
||||
//order the array so largest nondenom are first, then denominations, then very small inputs.
|
||||
sort(vCoins.rbegin(), vCoins.rend(), CompareByPriority());
|
||||
|
||||
//the first thing we get is a fee input, then we'll use as many denominated as possible. then the rest
|
||||
BOOST_FOREACH(const COutput& out, vCoins)
|
||||
{
|
||||
//there's no reason to allow inputs less than 1 COIN into DS (other than denominations smaller than that amount)
|
||||
if(out.tx->vout[out.i].nValue < 1*COIN && out.tx->vout[out.i].nValue != (.1*COIN)+100) continue;
|
||||
if(out.tx->vout[out.i].nValue < 1*COIN && !IsDenominatedAmount(out.tx->vout[out.i].nValue)) continue;
|
||||
if(fMasterNode && out.tx->vout[out.i].nValue == 1000*COIN) continue; //masternode input
|
||||
|
||||
if(nValueRet + out.tx->vout[out.i].nValue <= nValueMax){
|
||||
@ -1727,11 +1726,7 @@ bool CWallet::HasCollateralInputs() const
|
||||
|
||||
bool CWallet::IsCollateralAmount(int64_t nInputAmount) const
|
||||
{
|
||||
return nInputAmount == (DARKSEND_COLLATERAL * 5)+DARKSEND_FEE ||
|
||||
nInputAmount == (DARKSEND_COLLATERAL * 4)+DARKSEND_FEE ||
|
||||
nInputAmount == (DARKSEND_COLLATERAL * 3)+DARKSEND_FEE ||
|
||||
nInputAmount == (DARKSEND_COLLATERAL * 2)+DARKSEND_FEE ||
|
||||
nInputAmount == (DARKSEND_COLLATERAL * 1)+DARKSEND_FEE;
|
||||
return nInputAmount != 0 && nInputAmount % DARKSEND_COLLATERAL == 0 && nInputAmount < DARKSEND_COLLATERAL * 5;
|
||||
}
|
||||
|
||||
bool CWallet::SelectCoinsWithoutDenomination(int64_t nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const
|
||||
|
@ -782,10 +782,9 @@ public:
|
||||
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString().c_str(), i, nDepth, FormatMoney(tx->vout[i].nValue).c_str());
|
||||
}
|
||||
|
||||
//Used with Darksend. Will return fees, then denominations, everything else, then very small inputs that aren't fees
|
||||
//Used with Darksend. Will return largest nondenom, then denominations, then very small inputs
|
||||
int Priority() const
|
||||
{
|
||||
if(tx->vout[i].nValue == DARKSEND_FEE) return -20000;
|
||||
BOOST_FOREACH(int64_t d, darkSendDenominations)
|
||||
if(tx->vout[i].nValue == d) return 10000;
|
||||
if(tx->vout[i].nValue < 1*COIN) return 20000;
|
||||
|
Loading…
Reference in New Issue
Block a user