Skip to content

Commit

Permalink
avoid using constant pre/post blossom halving intervals in num_halvin…
Browse files Browse the repository at this point in the history
…gs()
  • Loading branch information
arya2 committed Sep 26, 2024
1 parent 13eb9b4 commit 2b2fcb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zebra-consensus/src/block/subsidy/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ pub fn num_halvings(height: Height, network: &Network) -> u32 {
0
} else if height < blossom_height {
let pre_blossom_height = height - slow_start_shift;
pre_blossom_height / PRE_BLOSSOM_HALVING_INTERVAL
pre_blossom_height / network.pre_blossom_halving_interval()
} else {
let pre_blossom_height = blossom_height - slow_start_shift;
let scaled_pre_blossom_height =
pre_blossom_height * HeightDiff::from(BLOSSOM_POW_TARGET_SPACING_RATIO);

let post_blossom_height = height - blossom_height;

(scaled_pre_blossom_height + post_blossom_height) / POST_BLOSSOM_HALVING_INTERVAL
(scaled_pre_blossom_height + post_blossom_height) / network.post_blossom_halving_interval()
};

halving_index
Expand Down

0 comments on commit 2b2fcb3

Please sign in to comment.