Skip to content

Commit b56607a

Browse files
Remove CCoinsViewCache::GetValueIn(...)
1 parent 844d207 commit b56607a

File tree

5 files changed

+0
-27
lines changed

5 files changed

+0
-27
lines changed

src/bench/ccoins_caching.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ static void CCoinsCaching(benchmark::State& state)
4747
while (state.KeepRunning()) {
4848
bool success = AreInputsStandard(tx_1, coins);
4949
assert(success);
50-
CAmount value = coins.GetValueIn(tx_1);
51-
assert(value == (50 + 21 + 22) * COIN);
5250
}
5351
ECC_Stop();
5452
}

src/coins.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,6 @@ unsigned int CCoinsViewCache::GetCacheSize() const {
233233
return cacheCoins.size();
234234
}
235235

236-
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
237-
{
238-
if (tx.IsCoinBase())
239-
return 0;
240-
241-
CAmount nResult = 0;
242-
for (unsigned int i = 0; i < tx.vin.size(); i++)
243-
nResult += AccessCoin(tx.vin[i].prevout).out.nValue;
244-
245-
return nResult;
246-
}
247-
248236
bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
249237
{
250238
if (!tx.IsCoinBase()) {

src/coins.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,6 @@ class CCoinsViewCache : public CCoinsViewBacked
315315
//! Calculate the size of the cache (in bytes)
316316
size_t DynamicMemoryUsage() const;
317317

318-
/**
319-
* Amount of bitcoins coming in to a transaction
320-
* Note that lightweight clients may not know anything besides the hash of previous transactions,
321-
* so may not be able to calculate this.
322-
*
323-
* @param[in] tx transaction for which we are checking input total
324-
* @return Sum of value of all inputs (scriptSigs)
325-
*/
326-
CAmount GetValueIn(const CTransaction& tx) const;
327-
328318
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
329319
bool HaveInputs(const CTransaction& tx) const;
330320

src/primitives/transaction.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ class CTransaction
324324

325325
// Return sum of txouts.
326326
CAmount GetValueOut() const;
327-
// GetValueIn() is a method on CCoinsViewCache, because
328-
// inputs must be known to compute value in.
329327

330328
/**
331329
* Get the total transaction size in bytes, including witness data.

src/test/transaction_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ BOOST_AUTO_TEST_CASE(test_Get)
305305
t1.vout[0].scriptPubKey << OP_1;
306306

307307
BOOST_CHECK(AreInputsStandard(CTransaction(t1), coins));
308-
BOOST_CHECK_EQUAL(coins.GetValueIn(CTransaction(t1)), (50+21+22)*CENT);
309308
}
310309

311310
static void CreateCreditAndSpend(const FillableSigningProvider& keystore, const CScript& outscript, CTransactionRef& output, CMutableTransaction& input, bool success = true)

0 commit comments

Comments
 (0)