Lagging chaintip fix

This commit is contained in:
jl777
2018-03-26 15:38:49 +03:00
parent 28ee65c78a
commit c60397dd3a
7 changed files with 19 additions and 15 deletions

View File

@@ -75,7 +75,7 @@ void EnsureWalletIsUnlocked()
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
}
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,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,int32_t tipheight);
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
@@ -2675,9 +2675,9 @@ UniValue listunspent(const UniValue& params, bool fHelp)
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
CBlockIndex *tipindex,*pindex = it->second;
uint64_t interest; uint32_t locktime; int32_t txheight;
komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue);
if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 )
{
komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight);
interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime);
entry.push_back(Pair("interest",ValueFromAmount(interest)));
}