Add explicit fee field to transaction

This commit is contained in:
Matt Corallo 2016-03-18 22:26:13 -07:00 committed by Gregory Sanders
parent fc86bc95c2
commit b8264355f1
32 changed files with 705 additions and 666 deletions

View file

@ -338,6 +338,20 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
return nResult;
}
bool CCoinsViewCache::VerifyAmounts(const CTransaction& tx, const CAmount& excess) const
{
if (!MoneyRange(excess) && !MoneyRange(-excess))
return false;
CAmount nInAmount = GetValueIn(tx);
for (std::vector<CTxOut>::const_iterator it(tx.vout.begin()); it != tx.vout.end(); ++it)
{
nInAmount -= it->nValue;
if (!MoneyRange(it->nValue) || (!MoneyRange(nInAmount) && !MoneyRange(-nInAmount)))
return false;
}
return excess == nInAmount;
}
bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
{
if (!tx.IsCoinBase()) {