@@ -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
9092inline uint32_t timestamp_high (const chain_state::data& values) NOEXCEPT
@@ -253,8 +255,7 @@ chain_state::activations chain_state::activation(const data& values,
253255
254256 // bip30_deactivate fork enforced above bip30_deactivate (bip34) checkpoint.
255257 const auto bip30_deactivate = forks.bip30 && forks.bip30_deactivate &&
256- (values.bip30_deactivate_hash ==
257- settings.bip30_deactivate_checkpoint .hash ());
258+ (values.bip30_deactivate_hash == settings.bip30_deactivate_checkpoint .hash ());
258259
259260 // bip30_reactivate fork is enforced above the bip30_reactivate height.
260261 const auto bip30_reactivate = bip30_deactivate && forks.bip30_reactivate &&
@@ -263,7 +264,7 @@ chain_state::activations chain_state::activation(const data& values,
263264 // bip30 is disabled by bip30_deactivate and reenabled by bip30_reactivate.
264265 // Otherwise if not exception, existing duplicate coinbase must be spent.
265266 if (forks.bip30 && (!bip30_deactivate || bip30_reactivate) &&
266- !is_bip30_exception ({ values.hash , height } ))
267+ !is_bip30_exception (values.hash , height))
267268 {
268269 result.flags |= flags::bip30_rule;
269270 }
@@ -650,6 +651,10 @@ chain_state::data chain_state::to_block(const chain_state& pool,
650651 data.timestamp .self = header.timestamp ();
651652 data.cumulative_work += header.proof ();
652653
654+ // Cache hash of bip30_deactivate block, otherwise use preceding state.
655+ if (data.height == settings.bip30_deactivate_checkpoint .height ())
656+ data.bip30_deactivate_hash = data.hash ;
657+
653658 // Cache hash of bip9 bit0 height block, otherwise use preceding state.
654659 if (data.height == settings.bip9_bit0_active_checkpoint .height ())
655660 data.bip9_bit0_hash = data.hash ;
@@ -689,6 +694,10 @@ chain_state::data chain_state::to_header(const chain_state& parent,
689694 data.timestamp .self = header.timestamp ();
690695 data.cumulative_work += header.proof ();
691696
697+ // Cache hash of bip30_deactivate block, otherwise use preceding state.
698+ if (data.height == settings.bip30_deactivate_checkpoint .height ())
699+ data.bip30_deactivate_hash = data.hash ;
700+
692701 // Cache hash of bip9 bit0 height block, otherwise use preceding state.
693702 if (data.height == settings.bip9_bit0_active_checkpoint .height ())
694703 data.bip9_bit0_hash = data.hash ;
0 commit comments