Skip to content

Commit 334662d

Browse files
committed
Avoid hash copy.
1 parent 3c257c6 commit 334662d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/chain/chain_state.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ constexpr bool is_retarget_height(size_t height,
8181
// These two blocks each have a coinbase transaction that exactly duplicates
8282
// another that is not spent by the arrival of the corresponding duplicate.
8383
// Exceptions: block 91842 (duplicates 91812), 91880 (duplicates 91722).
84-
inline bool is_bip30_exception(const checkpoint& check) NOEXCEPT
84+
inline bool is_bip30_exception(const hash_digest& hash, size_t height) NOEXCEPT
8585
{
86-
return (check == mainnet_bip30_exception_checkpoint1) ||
87-
(check == mainnet_bip30_exception_checkpoint2);
86+
return (hash == mainnet_bip30_exception_checkpoint1.hash() &&
87+
height == mainnet_bip30_exception_checkpoint1.height()) ||
88+
(hash == mainnet_bip30_exception_checkpoint2.hash() &&
89+
height == mainnet_bip30_exception_checkpoint2.height());
8890
}
8991

9092
inline uint32_t timestamp_high(const chain_state::data& values) NOEXCEPT
@@ -263,7 +265,7 @@ chain_state::activations chain_state::activation(const data& values,
263265
// bip30 is disabled by bip30_deactivate and reenabled by bip30_reactivate.
264266
// Otherwise if not exception, existing duplicate coinbase must be spent.
265267
if (forks.bip30 && (!bip30_deactivate || bip30_reactivate) &&
266-
!is_bip30_exception({ values.hash, height }))
268+
!is_bip30_exception(values.hash, height))
267269
{
268270
result.flags |= flags::bip30_rule;
269271
}

0 commit comments

Comments
 (0)