This commit is contained in:
jl777
2016-10-20 16:08:02 -03:00
parent 9a2d539ba7
commit 3127a4808b
2 changed files with 20 additions and 0 deletions

View File

@@ -383,6 +383,8 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
return coins->vout[input.prevout.n].scriptPubKey;
}
uint32_t komodo_txtime(uint256 hash);
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
{
if (tx.IsCoinBase())
@@ -391,6 +393,7 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
CAmount nResult = 0;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
fprintf(stderr,"i.%d time.%u\n",i,komodo_txtime(tx.vin[i].prevout.hash));
nResult += GetOutputFor(tx.vin[i]).nValue;
}
nResult += tx.GetJoinSplitValueIn();

View File

@@ -605,4 +605,21 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
}
}
uint32_t komodo_txtime(uint256 hash)
{
CTransaction tx;
uint256 hashBlock;
if (!GetTransaction(hash, tx, hashBlock, true))
return(0);
if (!hashBlock.IsNull()) {
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && (*mi).second)
{
CBlockIndex* pindex = (*mi).second;
if (chainActive.Contains(pindex))
return(pindex->GetBlockTime());
}
}
return(0);
}
#endif