@@ -25,37 +25,37 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp
|
|||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}"
|
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}"
|
||||||
|
|
||||||
|
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}"
|
||||||
|
#
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}"
|
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}"
|
||||||
|
|
||||||
|
|||||||
@@ -1507,17 +1507,17 @@ void komodo_args(char *argv0)
|
|||||||
KOMODO_PAX = 1;
|
KOMODO_PAX = 1;
|
||||||
} else KOMODO_PAX = GetArg("-pax",0);
|
} else KOMODO_PAX = GetArg("-pax",0);
|
||||||
name = GetArg("-ac_name","");
|
name = GetArg("-ac_name","");
|
||||||
if ( argv0 != 0 )
|
if ( argv0 != 0 )
|
||||||
{
|
{
|
||||||
len = (int32_t)strlen(argv0);
|
len = (int32_t)strlen(argv0);
|
||||||
for (i=0; i<sizeof(argv0suffix)/sizeof(*argv0suffix); i++)
|
for (i=0; i<sizeof(argv0suffix)/sizeof(*argv0suffix); i++)
|
||||||
{
|
{
|
||||||
n = (int32_t)strlen(argv0suffix[i]);
|
n = (int32_t)strlen(argv0suffix[i]);
|
||||||
if ( strcmp(&argv0[len - n],argv0suffix[i]) == 0 )
|
if ( strcmp(&argv0[len - n],argv0suffix[i]) == 0 )
|
||||||
{
|
{
|
||||||
printf("ARGV0.(%s) -> matches suffix (%s) -> ac_name.(%s)\n",argv0,argv0suffix[i],argv0names[i]);
|
//printf("ARGV0.(%s) -> matches suffix (%s) -> ac_name.(%s)\n",argv0,argv0suffix[i],argv0names[i]);
|
||||||
name = argv0names[i];
|
name = argv0names[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2202,7 +2202,7 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
|
|||||||
/**
|
/**
|
||||||
* populate vCoins with vector of available COutputs.
|
* populate vCoins with vector of available COutputs.
|
||||||
*/
|
*/
|
||||||
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue);
|
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue);
|
||||||
|
|
||||||
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const
|
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const
|
||||||
@@ -2250,9 +2250,9 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
|||||||
komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue);
|
komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue);
|
||||||
if ( (tipindex= chainActive.Tip()) != 0 )
|
if ( (tipindex= chainActive.Tip()) != 0 )
|
||||||
{
|
{
|
||||||
interest = komodo_interest(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime);
|
interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime);
|
||||||
} else interest = 0;
|
} else interest = 0;
|
||||||
//interest = komodo_interest(chainActive.Tip()->nHeight+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.Tip()->nTime);
|
//interest = komodo_interestnew(chainActive.Tip()->nHeight+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.Tip()->nTime);
|
||||||
if ( interest != 0 )
|
if ( interest != 0 )
|
||||||
{
|
{
|
||||||
//printf("wallet nValueRet %.8f += interest %.8f ht.%d lock.%u/%u tip.%u\n",(double)pcoin->vout[i].nValue/COIN,(double)interest/COIN,txheight,locktime,pcoin->nLockTime,tipindex->nTime);
|
//printf("wallet nValueRet %.8f += interest %.8f ht.%d lock.%u/%u tip.%u\n",(double)pcoin->vout[i].nValue/COIN,(double)interest/COIN,txheight,locktime,pcoin->nLockTime,tipindex->nTime);
|
||||||
@@ -2333,13 +2333,12 @@ static void ApproximateBestSubset(vector<pair<CAmount, pair<const CWalletTx*,uns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, vector<COutput> vCoins,set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, uint64_t *interestp) const
|
bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, vector<COutput> vCoins,set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet) const
|
||||||
{
|
{
|
||||||
uint64_t interests[10000],lowest_interest = 0; int32_t count = 0;
|
int32_t count = 0; //uint64_t lowest_interest = 0;
|
||||||
setCoinsRet.clear();
|
setCoinsRet.clear();
|
||||||
memset(interests,0,sizeof(interests));
|
//memset(interests,0,sizeof(interests));
|
||||||
nValueRet = 0;
|
nValueRet = 0;
|
||||||
//*interestp = 0;
|
|
||||||
// List of values less than target
|
// List of values less than target
|
||||||
pair<CAmount, pair<const CWalletTx*,unsigned int> > coinLowestLarger;
|
pair<CAmount, pair<const CWalletTx*,unsigned int> > coinLowestLarger;
|
||||||
coinLowestLarger.first = std::numeric_limits<CAmount>::max();
|
coinLowestLarger.first = std::numeric_limits<CAmount>::max();
|
||||||
@@ -2368,20 +2367,20 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
{
|
{
|
||||||
setCoinsRet.insert(coin.second);
|
setCoinsRet.insert(coin.second);
|
||||||
nValueRet += coin.first;
|
nValueRet += coin.first;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||||
*interestp += pcoin->vout[i].interest;
|
// *interestp += pcoin->vout[i].interest;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (n < nTargetValue + CENT)
|
else if (n < nTargetValue + CENT)
|
||||||
{
|
{
|
||||||
vValue.push_back(coin);
|
vValue.push_back(coin);
|
||||||
nTotalLower += n;
|
nTotalLower += n;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 && count < sizeof(interests)/sizeof(*interests) )
|
//if ( KOMODO_EXCHANGEWALLET == 0 && count < sizeof(interests)/sizeof(*interests) )
|
||||||
{
|
//{
|
||||||
//fprintf(stderr,"count.%d %.8f\n",count,(double)pcoin->vout[i].interest/COIN);
|
//fprintf(stderr,"count.%d %.8f\n",count,(double)pcoin->vout[i].interest/COIN);
|
||||||
interests[count++] = pcoin->vout[i].interest;
|
//interests[count++] = pcoin->vout[i].interest;
|
||||||
}
|
//}
|
||||||
if ( count >= sizeof(interests)/sizeof(*interests) && nTotalLower > 2*nTargetValue + CENT )
|
if ( nTotalLower > 4*nTargetValue + CENT )
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n");
|
//fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n");
|
||||||
break;
|
break;
|
||||||
@@ -2390,8 +2389,8 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
else if (n < coinLowestLarger.first)
|
else if (n < coinLowestLarger.first)
|
||||||
{
|
{
|
||||||
coinLowestLarger = coin;
|
coinLowestLarger = coin;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||||
lowest_interest = pcoin->vout[i].interest;
|
// lowest_interest = pcoin->vout[i].interest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2401,8 +2400,8 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
{
|
{
|
||||||
setCoinsRet.insert(vValue[i].second);
|
setCoinsRet.insert(vValue[i].second);
|
||||||
nValueRet += vValue[i].first;
|
nValueRet += vValue[i].first;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
|
//if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
|
||||||
*interestp += interests[i];
|
// *interestp += interests[i];
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2413,8 +2412,8 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
return false;
|
return false;
|
||||||
setCoinsRet.insert(coinLowestLarger.second);
|
setCoinsRet.insert(coinLowestLarger.second);
|
||||||
nValueRet += coinLowestLarger.first;
|
nValueRet += coinLowestLarger.first;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||||
*interestp += lowest_interest;
|
// *interestp += lowest_interest;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2434,8 +2433,8 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
{
|
{
|
||||||
setCoinsRet.insert(coinLowestLarger.second);
|
setCoinsRet.insert(coinLowestLarger.second);
|
||||||
nValueRet += coinLowestLarger.first;
|
nValueRet += coinLowestLarger.first;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||||
*interestp += lowest_interest;
|
// *interestp += lowest_interest;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (unsigned int i = 0; i < vValue.size(); i++)
|
for (unsigned int i = 0; i < vValue.size(); i++)
|
||||||
@@ -2443,8 +2442,8 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
{
|
{
|
||||||
setCoinsRet.insert(vValue[i].second);
|
setCoinsRet.insert(vValue[i].second);
|
||||||
nValueRet += vValue[i].first;
|
nValueRet += vValue[i].first;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
|
//if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
|
||||||
*interestp += interests[i];
|
// *interestp += interests[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint("selectcoins", "SelectCoins() best subset: ");
|
LogPrint("selectcoins", "SelectCoins() best subset: ");
|
||||||
@@ -2457,15 +2456,15 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl* coinControl,uint64_t *interestp) const
|
bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl* coinControl) const
|
||||||
{
|
{
|
||||||
// Output parameter fOnlyCoinbaseCoinsRet is set to true when the only available coins are coinbase utxos.
|
// Output parameter fOnlyCoinbaseCoinsRet is set to true when the only available coins are coinbase utxos.
|
||||||
uint64_t tmp,interest = 0; int32_t retval;
|
uint64_t tmp; int32_t retval;
|
||||||
if ( interestp == 0 )
|
//if ( interestp == 0 )
|
||||||
{
|
//{
|
||||||
interestp = &tmp;
|
// interestp = &tmp;
|
||||||
*interestp = 0;
|
// *interestp = 0;
|
||||||
}
|
//}
|
||||||
vector<COutput> vCoinsNoCoinbase, vCoinsWithCoinbase;
|
vector<COutput> vCoinsNoCoinbase, vCoinsWithCoinbase;
|
||||||
AvailableCoins(vCoinsNoCoinbase, true, coinControl, false, false);
|
AvailableCoins(vCoinsNoCoinbase, true, coinControl, false, false);
|
||||||
AvailableCoins(vCoinsWithCoinbase, true, coinControl, false, true);
|
AvailableCoins(vCoinsWithCoinbase, true, coinControl, false, true);
|
||||||
@@ -2507,8 +2506,8 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
|||||||
if (!out.fSpendable)
|
if (!out.fSpendable)
|
||||||
continue;
|
continue;
|
||||||
nValueRet += out.tx->vout[out.i].nValue;
|
nValueRet += out.tx->vout[out.i].nValue;
|
||||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||||
*interestp += out.tx->vout[out.i].interest;
|
// *interestp += out.tx->vout[out.i].interest;
|
||||||
setCoinsRet.insert(make_pair(out.tx, out.i));
|
setCoinsRet.insert(make_pair(out.tx, out.i));
|
||||||
}
|
}
|
||||||
return (nValueRet >= nTargetValue);
|
return (nValueRet >= nTargetValue);
|
||||||
@@ -2548,36 +2547,16 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
|||||||
retval = false;
|
retval = false;
|
||||||
if ( nTargetValue <= nValueFromPresetInputs )
|
if ( nTargetValue <= nValueFromPresetInputs )
|
||||||
retval = true;
|
retval = true;
|
||||||
else if ( SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet,&interest) != 0 )
|
else if ( SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet) != 0 )
|
||||||
{
|
|
||||||
*interestp += interest;
|
|
||||||
retval = true;
|
retval = true;
|
||||||
}
|
else if ( SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) != 0 )
|
||||||
else if ( SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet,&interest) != 0 )
|
|
||||||
{
|
|
||||||
*interestp += interest;
|
|
||||||
retval = true;
|
retval = true;
|
||||||
}
|
else if ( bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet) != 0 )
|
||||||
else if ( bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet,&interest) != 0 )
|
|
||||||
{
|
|
||||||
*interestp += interest;
|
|
||||||
retval = true;
|
retval = true;
|
||||||
}
|
|
||||||
|
|
||||||
//return (SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet,interestp) ||
|
|
||||||
// SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet,interestp) ||
|
|
||||||
// (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet,interestp)));
|
|
||||||
/*bool res = nTargetValue <= nValueFromPresetInputs ||
|
|
||||||
SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 1, 6, vCoins, setCoinsRet, nValueRet) ||
|
|
||||||
SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 1, 1, vCoins, setCoinsRet, nValueRet) ||
|
|
||||||
(bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, vCoins, setCoinsRet, nValueRet));*/
|
|
||||||
|
|
||||||
// because SelectCoinsMinConf clears the setCoinsRet, we now add the possible inputs to the coinset
|
// because SelectCoinsMinConf clears the setCoinsRet, we now add the possible inputs to the coinset
|
||||||
setCoinsRet.insert(setPresetCoins.begin(), setPresetCoins.end());
|
setCoinsRet.insert(setPresetCoins.begin(), setPresetCoins.end());
|
||||||
|
|
||||||
// add preset inputs to the total value selected
|
// add preset inputs to the total value selected
|
||||||
nValueRet += nValueFromPresetInputs;
|
nValueRet += nValueFromPresetInputs;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2627,7 +2606,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount &nFeeRet, int& nC
|
|||||||
bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet,
|
bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet,
|
||||||
int& nChangePosRet, std::string& strFailReason, const CCoinControl* coinControl, bool sign)
|
int& nChangePosRet, std::string& strFailReason, const CCoinControl* coinControl, bool sign)
|
||||||
{
|
{
|
||||||
uint64_t interest2,interest = 0; CAmount nValue = 0; unsigned int nSubtractFeeFromAmount = 0;
|
uint64_t interest2 = 0; CAmount nValue = 0; unsigned int nSubtractFeeFromAmount = 0;
|
||||||
BOOST_FOREACH (const CRecipient& recipient, vecSend)
|
BOOST_FOREACH (const CRecipient& recipient, vecSend)
|
||||||
{
|
{
|
||||||
if (nValue < 0 || recipient.nAmount < 0)
|
if (nValue < 0 || recipient.nAmount < 0)
|
||||||
@@ -2684,7 +2663,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
nFeeRet = 0;
|
nFeeRet = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
interest = 0;
|
//interest = 0;
|
||||||
txNew.vin.clear();
|
txNew.vin.clear();
|
||||||
txNew.vout.clear();
|
txNew.vout.clear();
|
||||||
wtxNew.fFromMe = true;
|
wtxNew.fFromMe = true;
|
||||||
@@ -2733,7 +2712,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
bool fOnlyCoinbaseCoins = false;
|
bool fOnlyCoinbaseCoins = false;
|
||||||
bool fNeedCoinbaseCoins = false;
|
bool fNeedCoinbaseCoins = false;
|
||||||
interest2 = 0;
|
interest2 = 0;
|
||||||
if (!SelectCoins(nTotalValue, setCoins, nValueIn, fOnlyCoinbaseCoins, fNeedCoinbaseCoins, coinControl,&interest))
|
if (!SelectCoins(nTotalValue, setCoins, nValueIn, fOnlyCoinbaseCoins, fNeedCoinbaseCoins, coinControl))
|
||||||
{
|
{
|
||||||
if (fOnlyCoinbaseCoins && Params().GetConsensus().fCoinbaseMustBeProtected) {
|
if (fOnlyCoinbaseCoins && Params().GetConsensus().fCoinbaseMustBeProtected) {
|
||||||
strFailReason = _("Coinbase funds can only be sent to a zaddr");
|
strFailReason = _("Coinbase funds can only be sent to a zaddr");
|
||||||
@@ -2762,13 +2741,13 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
age += 1;
|
age += 1;
|
||||||
dPriority += (double)nCredit * age;
|
dPriority += (double)nCredit * age;
|
||||||
}
|
}
|
||||||
if ( KOMODO_EXCHANGEWALLET != 0 )
|
//if ( KOMODO_EXCHANGEWALLET != 0 )
|
||||||
{
|
//{
|
||||||
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
|
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
|
||||||
interest = 0; // interest2 also
|
//interest = 0; // interest2 also
|
||||||
}
|
//}
|
||||||
CAmount nChange = (nValueIn - nValue + interest2);
|
CAmount nChange = (nValueIn - nValue + interest2);
|
||||||
fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest %.8f interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)interest/COIN,(double)nTotalValue/COIN);
|
fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN);
|
||||||
if (nSubtractFeeFromAmount == 0)
|
if (nSubtractFeeFromAmount == 0)
|
||||||
nChange -= nFeeRet;
|
nChange -= nFeeRet;
|
||||||
|
|
||||||
|
|||||||
@@ -584,7 +584,7 @@ public:
|
|||||||
class CWallet : public CCryptoKeyStore, public CValidationInterface
|
class CWallet : public CCryptoKeyStore, public CValidationInterface
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool SelectCoins(const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl *coinControl = NULL,uint64_t *interestp = NULL) const;
|
bool SelectCoins(const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl *coinControl = NULL) const;
|
||||||
|
|
||||||
CWalletDB *pwalletdbEncryption;
|
CWalletDB *pwalletdbEncryption;
|
||||||
|
|
||||||
@@ -811,7 +811,7 @@ public:
|
|||||||
bool CanSupportFeature(enum WalletFeature wf) { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; }
|
bool CanSupportFeature(enum WalletFeature wf) { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; }
|
||||||
|
|
||||||
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false, bool fIncludeCoinBase=true) const;
|
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false, bool fIncludeCoinBase=true) const;
|
||||||
bool SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, std::vector<COutput> vCoins, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet,uint64_t *interestp) const;
|
bool SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, std::vector<COutput> vCoins, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet) const;
|
||||||
|
|
||||||
bool IsSpent(const uint256& hash, unsigned int n) const;
|
bool IsSpent(const uint256& hash, unsigned int n) const;
|
||||||
bool IsSpent(const uint256& nullifier) const;
|
bool IsSpent(const uint256& nullifier) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user