test
This commit is contained in:
@@ -383,6 +383,8 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
|
|||||||
return coins->vout[input.prevout.n].scriptPubKey;
|
return coins->vout[input.prevout.n].scriptPubKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t komodo_txtime(uint256 hash);
|
||||||
|
|
||||||
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
||||||
{
|
{
|
||||||
if (tx.IsCoinBase())
|
if (tx.IsCoinBase())
|
||||||
@@ -391,6 +393,7 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
|||||||
CAmount nResult = 0;
|
CAmount nResult = 0;
|
||||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
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 += GetOutputFor(tx.vin[i]).nValue;
|
||||||
}
|
}
|
||||||
nResult += tx.GetJoinSplitValueIn();
|
nResult += tx.GetJoinSplitValueIn();
|
||||||
|
|||||||
17
src/komodo.h
17
src/komodo.h
@@ -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
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user