Merge #10558: Address nits from per-utxo change
21d4afa12 Comment clarifications in coins.cpp (Alex Morcos) 3c8a9aeff Add belt-and-suspenders in DisconnectBlock (Alex Morcos) Tree-SHA512: d83e12ed71674faaaaebc03ffa1e2276984c35a29db419268ac9e14a45b33ccab716e3606dff8cfe1dcee4bec6e4794d2ca90341f10d5684be80e3fee61addf8
This commit is contained in:
parent
549839a504
commit
5b232161a7
@ -305,6 +305,9 @@ private:
|
|||||||
void AddCoins(CCoinsViewCache& cache, const CTransaction& tx, int nHeight);
|
void AddCoins(CCoinsViewCache& cache, const CTransaction& tx, int nHeight);
|
||||||
|
|
||||||
//! Utility function to find any unspent output with a given txid.
|
//! Utility function to find any unspent output with a given txid.
|
||||||
|
// This function can be quite expensive because in the event of a transaction
|
||||||
|
// which is not found in the cache, it can cause up to MAX_OUTPUTS_PER_BLOCK
|
||||||
|
// lookups to database, so it should be used with care.
|
||||||
const Coin& AccessByTxid(const CCoinsViewCache& cache, const uint256& txid);
|
const Coin& AccessByTxid(const CCoinsViewCache& cache, const uint256& txid);
|
||||||
|
|
||||||
#endif // BITCOIN_COINS_H
|
#endif // BITCOIN_COINS_H
|
||||||
|
@ -1715,6 +1715,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& s
|
|||||||
for (int i = block.vtx.size() - 1; i >= 0; i--) {
|
for (int i = block.vtx.size() - 1; i >= 0; i--) {
|
||||||
const CTransaction &tx = block.vtx[i];
|
const CTransaction &tx = block.vtx[i];
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
|
bool is_coinbase = tx.IsCoinBase();
|
||||||
|
|
||||||
if (fAddressIndex) {
|
if (fAddressIndex) {
|
||||||
|
|
||||||
@ -1754,7 +1755,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& s
|
|||||||
COutPoint out(hash, o);
|
COutPoint out(hash, o);
|
||||||
Coin coin;
|
Coin coin;
|
||||||
bool is_spent = view.SpendCoin(out, &coin);
|
bool is_spent = view.SpendCoin(out, &coin);
|
||||||
if (!is_spent || tx.vout[o] != coin.out) {
|
if (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase) {
|
||||||
fClean = false; // transaction output mismatch
|
fClean = false; // transaction output mismatch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user