test
This commit is contained in:
@@ -384,7 +384,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
|
||||
}
|
||||
|
||||
//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
uint64_t komodo_accrued_interest(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);
|
||||
extern char ASSETCHAINS_SYMBOL[16];
|
||||
|
||||
CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const
|
||||
@@ -402,11 +402,11 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
|
||||
{
|
||||
//if ( value >= COIN*100 )
|
||||
{
|
||||
int64_t interest;
|
||||
interest = komodo_accrued_interest(tx.vin[i].prevout.hash,tx.vin[i].prevout.n,nHeight,value);
|
||||
int64_t interest; int32_t txheight; uint32_t locktime;
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value);
|
||||
//interest = komodo_interest(nHeight,value,tx.nLockTime,tiptime);
|
||||
printf("nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,nHeight,tx.nLockTime,tiptime);
|
||||
fprintf(stderr,"nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,nHeight,tx.nLockTime,tiptime);
|
||||
printf("nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime);
|
||||
fprintf(stderr,"nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime);
|
||||
nResult += interest;
|
||||
(*interestp) += interest;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace std;
|
||||
|
||||
#include "komodo_interest.h"
|
||||
|
||||
uint64_t komodo_accrued_interest(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)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -570,15 +570,15 @@ uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *va
|
||||
}
|
||||
|
||||
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
uint64_t komodo_accrued_interest(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)
|
||||
{
|
||||
uint64_t value; int32_t txheight; uint32_t locktime,tiptime;
|
||||
if ( (locktime= komodo_interest_args(&txheight,&tiptime,&value,hash,n)) != 0 )
|
||||
uint64_t value; uint32_t tiptime;
|
||||
if ( (*locktimep= komodo_interest_args(txheightp,&tiptime,&value,hash,n)) != 0 )
|
||||
{
|
||||
if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || txheight == checkheight) )
|
||||
return(komodo_interest(txheight,value,locktime,tiptime));
|
||||
if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) )
|
||||
return(komodo_interest(*txheightp,value,*locktimep,tiptime));
|
||||
//fprintf(stderr,"nValue %llu lock.%u:%u nTime.%u -> %llu\n",(long long)coins.vout[n].nValue,coins.nLockTime,timestamp,pindex->nTime,(long long)interest);
|
||||
} else fprintf(stderr,"komodo_accrued_interest value mismatch %llu vs %llu or height mismatch %d vs %d\n",(long long)value,(long long)checkvalue,txheight,checkheight);
|
||||
} else fprintf(stderr,"komodo_accrued_interest value mismatch %llu vs %llu or height mismatch %d vs %d\n",(long long)value,(long long)checkvalue,*txheightp,checkheight);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -505,7 +505,7 @@ Value paxprices(const Array& params, bool fHelp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t komodo_accrued_interest(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);
|
||||
|
||||
Value gettxout(const Array& params, bool fHelp)
|
||||
{
|
||||
@@ -577,8 +577,8 @@ Value gettxout(const Array& params, bool fHelp)
|
||||
ret.push_back(Pair("confirmations", 0));
|
||||
else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1));
|
||||
ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
|
||||
uint64_t interest;
|
||||
if ( (interest= komodo_accrued_interest(hash,n,coins.nHeight,coins.vout[n].nValue)) != 0 )
|
||||
uint64_t interest; int32_t txheight; uint32_t locktime;
|
||||
if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue)) != 0 )
|
||||
ret.push_back(Pair("interest", ValueFromAmount(interest)));
|
||||
Object o;
|
||||
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
|
||||
|
||||
@@ -2354,7 +2354,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
return true;
|
||||
}
|
||||
|
||||
//uint64_t komodo_accrued_interest(uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue);
|
||||
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
|
||||
bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, bool& fOnlyCoinbaseCoinsRet, bool& fNeedCoinbaseCoinsRet, const CCoinControl* coinControl) const
|
||||
|
||||
Reference in New Issue
Block a user