test
This commit is contained in:
@@ -451,7 +451,7 @@ 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)));
|
||||
ret.push_back(Pair("interest", ValueFromAmount(komodo_interest(coins.vout[n].nValue,coins.nLockTime,coins.nTime))));
|
||||
ret.push_back(Pair("interest", ValueFromAmount(komodo_interest(coins.vout[n].nValue,coins.nLockTime,pindex->nTime))));
|
||||
Object o;
|
||||
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
|
||||
ret.push_back(Pair("scriptPubKey", o));
|
||||
|
||||
@@ -121,14 +121,19 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
|
||||
}
|
||||
entry.push_back(Pair("vin", vin));
|
||||
Array vout;
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *pindex = it->second;
|
||||
uint64_t interest;
|
||||
for (unsigned int i = 0; i < tx.vout.size(); i++) {
|
||||
const CTxOut& txout = tx.vout[i];
|
||||
Object out;
|
||||
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
|
||||
interest = komodo_interest(txout.nValue,tx.nLockTime,chainActive.Tip()->nTime));
|
||||
fprintf(stderr,"TxtoJSON interest %llu %.8f\n",(long long)interest,(double)interest/COIN);
|
||||
out.push_back(Pair("interest", ValueFromAmount(interest));
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
interest = komodo_interest(txout.nValue,tx.nLockTime,pindex->nTime);
|
||||
fprintf(stderr,"TxtoJSON interest %llu %.8f\n",(long long)interest,(double)interest/COIN);
|
||||
out.push_back(Pair("interest", ValueFromAmount(interest)));
|
||||
}
|
||||
out.push_back(Pair("n", (int64_t)i));
|
||||
Object o;
|
||||
ScriptPubKeyToJSON(txout.scriptPubKey, o, true);
|
||||
|
||||
@@ -2364,8 +2364,13 @@ Value listunspent(const Array& params, bool fHelp)
|
||||
}
|
||||
}
|
||||
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
|
||||
fprintf(stderr,"nLock.%u tip.%u\n",tx->nLockTime,chainActive.Tip()->nTime);
|
||||
entry.push_back(Pair("interest",ValueFromAmount(komodo_interest(nValue,out.tx->nLockTime,chainActive.Tip()->nTime))));
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *pindex = it->second;
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
fprintf(stderr,"nLock.%u tip.%u\n",tx->nLockTime,chainActive.Tip()->nTime);
|
||||
entry.push_back(Pair("interest",ValueFromAmount(komodo_interest(nValue,out.tx->nLockTime,pindex->nTime))));
|
||||
}
|
||||
entry.push_back(Pair("confirmations",out.nDepth));
|
||||
entry.push_back(Pair("spendable", out.fSpendable));
|
||||
results.push_back(entry);
|
||||
|
||||
@@ -2334,6 +2334,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
}
|
||||
|
||||
uint64_t komodo_interest(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
|
||||
{
|
||||
// Output parameter fOnlyCoinbaseCoinsRet is set to true when the only available coins are coinbase utxos.
|
||||
|
||||
Reference in New Issue
Block a user