|
|
@ -99,12 +99,12 @@ void CCoinsViewCache::AddCoin(const COutPoint &outpoint, Coin&& coin, bool possi
|
|
|
|
cachedCoinsUsage += it->second.coin.DynamicMemoryUsage();
|
|
|
|
cachedCoinsUsage += it->second.coin.DynamicMemoryUsage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight, bool check) {
|
|
|
|
void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight, bool check_for_overwrite) {
|
|
|
|
bool fCoinbase = tx.IsCoinBase();
|
|
|
|
bool fCoinbase = tx.IsCoinBase();
|
|
|
|
const uint256& txid = tx.GetHash();
|
|
|
|
const uint256& txid = tx.GetHash();
|
|
|
|
for (size_t i = 0; i < tx.vout.size(); ++i) {
|
|
|
|
for (size_t i = 0; i < tx.vout.size(); ++i) {
|
|
|
|
bool overwrite = check ? cache.HaveCoin(COutPoint(txid, i)) : fCoinbase;
|
|
|
|
bool overwrite = check_for_overwrite ? cache.HaveCoin(COutPoint(txid, i)) : fCoinbase;
|
|
|
|
// Always set the possible_overwrite flag to AddCoin for coinbase txn, in order to correctly
|
|
|
|
// Coinbase transactions can always be overwritten, in order to correctly
|
|
|
|
// deal with the pre-BIP30 occurrences of duplicate coinbase transactions.
|
|
|
|
// deal with the pre-BIP30 occurrences of duplicate coinbase transactions.
|
|
|
|
cache.AddCoin(COutPoint(txid, i), Coin(tx.vout[i], nHeight, fCoinbase), overwrite);
|
|
|
|
cache.AddCoin(COutPoint(txid, i), Coin(tx.vout[i], nHeight, fCoinbase), overwrite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|