Esempio n. 1
0
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
{
    if (tx.IsCoinBase())
        return 0;

    CAmount nResult = 0;
    for (unsigned int i = 0; i < tx.vin.size(); i++)
        nResult += AccessCoin(tx.vin[i].prevout).out.nValue;

    return nResult;
}
Esempio n. 2
0
double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight, CAmount &inChainInputValue) const
{
    inChainInputValue = 0;
    if (tx.IsCoinBase())
        return 0.0;
    double dResult = 0.0;
    BOOST_FOREACH(const CTxIn& txin, tx.vin)
    {
        const Coin& coin = AccessCoin(txin.prevout);
        if (coin.IsSpent()) continue;
        if (coin.nHeight <= nHeight) {
            dResult += coin.out.nValue * (nHeight-coin.nHeight);
            inChainInputValue += coin.out.nValue;
        }
    }
    return tx.ComputePriority(dResult);
}
Esempio n. 3
0
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
{
    if (tx.IsCoinBase() && !tx.IsPoW2WitnessCoinBase())
        return 0;

    CAmount nResult = 0;
    for (unsigned int i = 0; i < tx.vin.size(); i++)
    {
        CAmount coinAmount = AccessCoin(tx.vin[i].prevout).out.nValue;
        if (coinAmount != -1)
        {
            nResult += coinAmount;
        }
    }

    return nResult;
}