From 0a248708dc9d465db09168c39b3f12cb4c9465b7 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Mon, 24 Jan 2022 15:02:09 -0500 Subject: [PATCH] indexes, refactor: Stop requiring CBlockIndex type to call IsBIP30Unspendable This commit does not change behavior in any way. --- src/index/coinstatsindex.cpp | 2 +- src/validation.cpp | 6 +++--- src/validation.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index b5869416b93..9ec034ce3c5 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -150,7 +150,7 @@ bool CoinStatsIndex::CustomAppend(const interfaces::BlockInfo& block) const auto& tx{block.data->vtx.at(i)}; // Skip duplicate txid coinbase transactions (BIP30). - if (IsBIP30Unspendable(*pindex) && tx->IsCoinBase()) { + if (IsBIP30Unspendable(block.hash, block.height) && tx->IsCoinBase()) { m_total_unspendable_amount += block_subsidy; m_total_unspendables_bip30 += block_subsidy; continue; diff --git a/src/validation.cpp b/src/validation.cpp index 97190dc2486..b87de9c4563 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -6341,10 +6341,10 @@ bool IsBIP30Repeat(const CBlockIndex& block_index) (block_index.nHeight==91880 && block_index.GetBlockHash() == uint256{"00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"}); } -bool IsBIP30Unspendable(const CBlockIndex& block_index) +bool IsBIP30Unspendable(const uint256& block_hash, int block_height) { - return (block_index.nHeight==91722 && block_index.GetBlockHash() == uint256{"00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e"}) || - (block_index.nHeight==91812 && block_index.GetBlockHash() == uint256{"00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f"}); + return (block_height==91722 && block_hash == uint256{"00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e"}) || + (block_height==91812 && block_hash == uint256{"00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f"}); } static fs::path GetSnapshotCoinsDBPath(Chainstate& cs) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) diff --git a/src/validation.h b/src/validation.h index 0a8a94db120..b2ac117698e 100644 --- a/src/validation.h +++ b/src/validation.h @@ -1350,6 +1350,6 @@ bool DeploymentEnabled(const ChainstateManager& chainman, DEP dep) bool IsBIP30Repeat(const CBlockIndex& block_index); /** Identifies blocks which coinbase output was subsequently overwritten in the UTXO set (see BIP30) */ -bool IsBIP30Unspendable(const CBlockIndex& block_index); +bool IsBIP30Unspendable(const uint256& block_hash, int block_height); #endif // BITCOIN_VALIDATION_H