test
This commit is contained in:
@@ -381,6 +381,8 @@ Value gettxoutsetinfo(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t komodo_interest(uint64_t nValue,uint32_t pastlocktime,uint32_t tiptime);
|
uint64_t komodo_interest(uint64_t nValue,uint32_t pastlocktime,uint32_t tiptime);
|
||||||
|
uint32_t komodo_txtime(uint256 hash);
|
||||||
|
|
||||||
Value gettxout(const Array& params, bool fHelp)
|
Value gettxout(const Array& params, bool fHelp)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() < 2 || params.size() > 3)
|
if (fHelp || params.size() < 2 || params.size() > 3)
|
||||||
@@ -445,20 +447,18 @@ Value gettxout(const Array& params, bool fHelp)
|
|||||||
return Value::null;
|
return Value::null;
|
||||||
|
|
||||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||||
BlockMap::iterator it2 = mapBlockIndex.find(hash);
|
CBlockIndex *pindex = it->second;
|
||||||
CBlockIndex *pindex2,*pindex = it->second;
|
|
||||||
ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
|
ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
|
||||||
if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT)
|
if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT)
|
||||||
ret.push_back(Pair("confirmations", 0));
|
ret.push_back(Pair("confirmations", 0));
|
||||||
else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1));
|
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("value", ValueFromAmount(coins.vout[n].nValue)));
|
||||||
if ( (pindex2= it2->second) != 0 )
|
|
||||||
{
|
uint64_t interest; uint32_t timestamp = komodo_txtime(hash);
|
||||||
uint64_t interest;
|
interest = komodo_interest(coins.vout[n].nValue,timestamp,pindex->nTime);
|
||||||
interest = komodo_interest(coins.vout[n].nValue,pindex2->nTime,pindex->nTime);
|
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);
|
||||||
fprintf(stderr,"nValue %llu lock.%u nTime.%u -> %llu\n",(long long)coins.vout[n].nValue,coins.nLockTime,pindex2->nTime,(long long)interest);
|
ret.push_back(Pair("interest", ValueFromAmount(interest)));
|
||||||
ret.push_back(Pair("interest", ValueFromAmount(interest)));
|
|
||||||
}
|
|
||||||
Object o;
|
Object o;
|
||||||
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
|
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
|
||||||
ret.push_back(Pair("scriptPubKey", o));
|
ret.push_back(Pair("scriptPubKey", o));
|
||||||
|
|||||||
Reference in New Issue
Block a user