mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Add explicit fee field to transaction
This commit is contained in:
parent
fc86bc95c2
commit
b8264355f1
32 changed files with 705 additions and 666 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue