test
This commit is contained in:
@@ -397,7 +397,9 @@ CAmount CCoinsViewCache::GetValueIn(int64_t *interestp,const CTransaction& tx,ui
|
||||
value = GetOutputFor(tx.vin[i]).nValue;
|
||||
nResult += value;
|
||||
interest = komodo_interest(value,tx.nLockTime,tiptime);
|
||||
#ifdef KOMODO_ENABLE_INTEREST
|
||||
nResult += interest;
|
||||
#endif
|
||||
(*interestp) += interest;
|
||||
}
|
||||
nResult += tx.GetJoinSplitValueIn();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
//#define KOMODO_ENABLE_INTEREST
|
||||
|
||||
#define KOMODO_INTEREST ((uint64_t)(0.05 * COIN))
|
||||
#define dstr(x) ((double)(x)/COIN)
|
||||
@@ -16,5 +17,5 @@ uint64_t komodo_interest(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||
interest = (numerator / denominator) / COIN;
|
||||
fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)nValue,dstr(nValue),nLockTime,tiptime,minutes,(long long)interest,dstr(interest),(long long)numerator,(long long)denominator);
|
||||
}
|
||||
return(interest * 0);
|
||||
return(interest);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
|
||||
const CTxOut& txout = tx.vout[i];
|
||||
Object out;
|
||||
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
|
||||
if ( pindex != 0 )
|
||||
if ( pindex != 0 && tx.nLockTime != 0 )
|
||||
{
|
||||
interest = komodo_interest(txout.nValue,tx.nLockTime,pindex->nTime);
|
||||
fprintf(stderr,"TxtoJSON interest %llu %.8f\n",(long long)interest,(double)interest/COIN);
|
||||
|
||||
@@ -2364,12 +2364,17 @@ Value listunspent(const Array& params, bool fHelp)
|
||||
}
|
||||
}
|
||||
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *pindex = it->second;
|
||||
if ( pindex != 0 )
|
||||
if ( out.tx->nLockTime != 0 )
|
||||
{
|
||||
fprintf(stderr,"nLock.%u tip.%u %u\n",out.tx->nLockTime,chainActive.Tip()->nTime,pindex->nTime);
|
||||
entry.push_back(Pair("interest",ValueFromAmount(komodo_interest(nValue,out.tx->nLockTime,pindex->nTime))));
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *pindex = it->second;
|
||||
uint64_t interest;
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
interest = komodo_interest(nValue,out.tx->nLockTime,pindex->nTime);
|
||||
fprintf(stderr,"nLock.%u tip.%u %u interest.%llu\n",out.tx->nLockTime,chainActive.Tip()->nTime,pindex->nTime,(long long)interest);
|
||||
entry.push_back(Pair("interest",ValueFromAmount(interest)));
|
||||
}
|
||||
}
|
||||
entry.push_back(Pair("confirmations",out.nDepth));
|
||||
entry.push_back(Pair("spendable", out.fSpendable));
|
||||
|
||||
@@ -2378,7 +2378,9 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
continue;
|
||||
nValueRet += out.tx->vout[out.i].nValue;
|
||||
interest = komodo_interest(out.tx->vout[out.i].nValue,out.tx->nLockTime,chainActive.Tip()->nTime);
|
||||
#ifdef KOMODO_ENABLE_INTEREST
|
||||
nValueRet += interest;
|
||||
#endif
|
||||
fprintf(stderr,"interest %llu from %llu lock.%u tip.%u\n",(long long)interest,(long long)out.tx->vout[out.i].nValue,out.tx->nLockTime,chainActive.Tip()->nTime);
|
||||
setCoinsRet.insert(make_pair(out.tx, out.i));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user