Merge CCoinsViewCache's GetOutputFor and AccessCoin
They're doing the same thing now.
This commit is contained in:
parent
580b023092
commit
119e552f7c
4 changed files with 5 additions and 14 deletions
|
@ -213,13 +213,6 @@ unsigned int CCoinsViewCache::GetCacheSize() const {
|
|||
return cacheCoins.size();
|
||||
}
|
||||
|
||||
const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
|
||||
{
|
||||
const Coin& coin = AccessCoin(input.prevout);
|
||||
assert(!coin.IsPruned());
|
||||
return coin.out;
|
||||
}
|
||||
|
||||
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
||||
{
|
||||
if (tx.IsCoinBase())
|
||||
|
@ -227,7 +220,7 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
|||
|
||||
CAmount nResult = 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
nResult += GetOutputFor(tx.vin[i]).nValue;
|
||||
nResult += AccessCoin(tx.vin[i].prevout).out.nValue;
|
||||
|
||||
return nResult;
|
||||
}
|
||||
|
|
|
@ -272,8 +272,6 @@ public:
|
|||
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
|
||||
bool HaveInputs(const CTransaction& tx) const;
|
||||
|
||||
const CTxOut &GetOutputFor(const CTxIn& input) const;
|
||||
|
||||
private:
|
||||
CCoinsMap::iterator FetchCoins(const COutPoint &outpoint) const;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in
|
|||
unsigned int nSigOps = 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]);
|
||||
const CTxOut &prevout = inputs.AccessCoin(tx.vin[i].prevout).out;
|
||||
if (prevout.scriptPubKey.IsPayToScriptHash())
|
||||
nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& i
|
|||
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]);
|
||||
const CTxOut &prevout = inputs.AccessCoin(tx.vin[i].prevout).out;
|
||||
nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, prevout.scriptPubKey, &tx.vin[i].scriptWitness, flags);
|
||||
}
|
||||
return nSigOps;
|
||||
|
|
|
@ -165,7 +165,7 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
|
|||
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
const CTxOut& prev = mapInputs.GetOutputFor(tx.vin[i]);
|
||||
const CTxOut& prev = mapInputs.AccessCoin(tx.vin[i].prevout).out;
|
||||
|
||||
std::vector<std::vector<unsigned char> > vSolutions;
|
||||
txnouttype whichType;
|
||||
|
@ -204,7 +204,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
|
|||
if (tx.vin[i].scriptWitness.IsNull())
|
||||
continue;
|
||||
|
||||
const CTxOut &prev = mapInputs.GetOutputFor(tx.vin[i]);
|
||||
const CTxOut &prev = mapInputs.AccessCoin(tx.vin[i].prevout).out;
|
||||
|
||||
// get the scriptPubKey corresponding to this input:
|
||||
CScript prevScript = prev.scriptPubKey;
|
||||
|
|
Loading…
Reference in a new issue