Skip to content

Commit

Permalink
[Core] PIVX: remove potential_overwrite: BIP34 has always been enforced
Browse files Browse the repository at this point in the history
ref: #1775
  • Loading branch information
random-zebra committed Aug 23, 2020
1 parent 16924aa commit 53fc2be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/coins.cpp
Expand Up @@ -171,6 +171,7 @@ void CCoinsViewCache::AddCoin(const COutPoint& outpoint, Coin&& coin, bool possi
}
fresh = it->second.coins.IsPruned() && !(it->second.flags & CCoinsCacheEntry::DIRTY);
}

if (it->second.coins.vout.size() <= outpoint.n) {
it->second.coins.vout.resize(outpoint.n + 1);
}
Expand All @@ -188,9 +189,7 @@ void AddCoins(CCoinsViewCache& cache, const CTransaction& tx, int nHeight)
bool fCoinstake = tx.IsCoinStake();
const uint256& txid = tx.GetHash();
for (size_t i = 0; i < tx.vout.size(); ++i) {
// Pass fCoinbase as the possible_overwrite flag to AddCoin, in order to correctly
// deal with the pre-BIP30 occurrances of duplicate coinbase transactions.
cache.AddCoin(COutPoint(txid, i), Coin(tx.vout[i], nHeight, fCoinbase, fCoinstake), fCoinbase);
cache.AddCoin(COutPoint(txid, i), Coin(tx.vout[i], nHeight, fCoinbase, fCoinstake), false);
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/coins.h
Expand Up @@ -598,9 +598,7 @@ class CCoinsViewCache : public CCoinsViewBacked
};

//! Utility function to add all of a transaction's outputs to a cache.
// It assumes that overwrites are only possible for coinbase transactions,
// TODO: pass in a boolean to limit these possible overwrites to known
// (pre-BIP34) cases.
// PIVX: It assumes that overwrites are never possible due to BIP34 always in effect
void AddCoins(CCoinsViewCache& cache, const CTransaction& tx, int nHeight);

//! Utility function to find any unspent output with a given txid.
Expand Down

0 comments on commit 53fc2be

Please sign in to comment.