From 65f834f92a7e93f4e7f8d86ed834276e753845bb Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 16 Mar 2024 14:14:59 -0400 Subject: [PATCH 1/2] Request bip9 chain_state at target heights. --- src/chain/chain_state.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chain/chain_state.cpp b/src/chain/chain_state.cpp index 1d320bcf9e..a4aaf75895 100644 --- a/src/chain/chain_state.cpp +++ b/src/chain/chain_state.cpp @@ -427,8 +427,8 @@ size_t chain_state::bip9_bit0_height(size_t height, { const auto activation_height = bip9_bit0_active_checkpoint.height(); - // Require bip9_bit0 hash at heights above historical bip9_bit0 activation. - return height > activation_height ? activation_height : map::unrequested; + // Require bip9_bit0 hash at heights at/above bip9_bit0 activation. + return height >= activation_height ? activation_height : map::unrequested; } size_t chain_state::bip9_bit1_height(size_t height, @@ -436,8 +436,8 @@ size_t chain_state::bip9_bit1_height(size_t height, { const auto activation_height = bip9_bit1_active_checkpoint.height(); - // Require bip9_bit1 hash at heights above historical bip9_bit1 activation. - return height > activation_height ? activation_height : map::unrequested; + // Require bip9_bit1 hash at heights at/above bip9_bit1 activation. + return height >= activation_height ? activation_height : map::unrequested; } // Public static From 52dcbfc793cde6b1d65d5084f29df806658de582 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 16 Mar 2024 14:43:38 -0400 Subject: [PATCH 2/2] Style, comments. --- src/chain/chain_state.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chain/chain_state.cpp b/src/chain/chain_state.cpp index a4aaf75895..43f4c4fb81 100644 --- a/src/chain/chain_state.cpp +++ b/src/chain/chain_state.cpp @@ -428,7 +428,7 @@ size_t chain_state::bip9_bit0_height(size_t height, const auto activation_height = bip9_bit0_active_checkpoint.height(); // Require bip9_bit0 hash at heights at/above bip9_bit0 activation. - return height >= activation_height ? activation_height : map::unrequested; + return height < activation_height ? map::unrequested : activation_height; } size_t chain_state::bip9_bit1_height(size_t height, @@ -437,7 +437,7 @@ size_t chain_state::bip9_bit1_height(size_t height, const auto activation_height = bip9_bit1_active_checkpoint.height(); // Require bip9_bit1 hash at heights at/above bip9_bit1 activation. - return height >= activation_height ? activation_height : map::unrequested; + return height < activation_height ? map::unrequested : activation_height; } // Public static @@ -472,11 +472,11 @@ chain_state::map chain_state::get_map(size_t height, // The most recent past retarget height. map.timestamp_retarget = retarget_height(height, forks, interval); - // The checkpoint above which bip9_bit0 rules are enforced. + // The checkpoint at/above which bip9_bit0 rules are enforced. map.bip9_bit0_height = bip9_bit0_height(height, settings.bip9_bit0_active_checkpoint); - // The checkpoint above which bip9_bit1 rules are enforced. + // The checkpoint at/above which bip9_bit1 rules are enforced. map.bip9_bit1_height = bip9_bit1_height(height, settings.bip9_bit1_active_checkpoint);