From 382c22eaa7b7c428570f579ac535575307d8c6b7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 22 Oct 2016 12:31:43 -0300 Subject: [PATCH] test --- src/rpcblockchain.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index c9c13b7a0..afdcc8607 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -445,18 +445,20 @@ Value gettxout(const Array& params, bool fHelp) return Value::null; BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); - CBlockIndex *pindex = it->second; + BlockMap::iterator it2 = mapBlockIndex.find(hash); + CBlockIndex *pindex2,*pindex = it->second; ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex())); if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT) 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))); - + if ( (pindex2= it2->second) != 0 ) + { uint64_t interest; - interest = komodo_interest(coins.vout[n].nValue,coins.nLockTime,pindex->nTime); - fprintf(stderr,"nValue %llu lock.%u nTime.%u -> %llu\n",(long long)coins.vout[n].nValue,coins.nLockTime,pindex->nTime,(long long)interest); + interest = komodo_interest(coins.vout[n].nValue,pindex2->nTime,pindex->nTime); + 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))); - + } Object o; ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); ret.push_back(Pair("scriptPubKey", o));