Skip to content

Commit

Permalink
Update variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
raychu86 committed Nov 30, 2022
1 parent b7d859b commit dc87cfa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions node/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ use time::OffsetDateTime;
use rayon::prelude::*;

// TODO (raychu86): Remove this after Phase 2.
/// The block height that the new coinbase targeting algorithm starts.
const V4_START_HEIGHT: u32 = 120000;
/// The block height to start preparing the new coinbase targeting algorithm.
const PREPARE_V4_START_HEIGHT: u32 = 120000;
/// The block height to start checking the new coinbase targeting algorithm.
const CHECK_V4_START_HEIGHT: u32 = 127500;

Expand Down Expand Up @@ -248,7 +248,7 @@ impl<N: Network, C: ConsensusStorage<N>> Consensus<N, C> {
}

// Construct the next coinbase target.
let next_coinbase_target = match next_height >= V4_START_HEIGHT {
let next_coinbase_target = match next_height >= PREPARE_V4_START_HEIGHT {
true => coinbase_target::<true>(
latest_block.last_coinbase_target(),
latest_block.last_coinbase_timestamp(),
Expand Down Expand Up @@ -453,7 +453,7 @@ impl<N: Network, C: ConsensusStorage<N>> Consensus<N, C> {
}

// Construct the next coinbase target.
let expected_coinbase_target = match block.height() >= V4_START_HEIGHT {
let expected_coinbase_target = match block.height() >= PREPARE_V4_START_HEIGHT {
true => coinbase_target::<true>(
self.ledger.last_coinbase_target(),
self.ledger.last_coinbase_timestamp(),
Expand All @@ -471,8 +471,8 @@ impl<N: Network, C: ConsensusStorage<N>> Consensus<N, C> {
}?;

// TODO (raychu86): Remove this if statement after Phase 2.
// Do not check the coinbase target between `V4_START_HEIGHT` and `CHECK_V4_START_HEIGHT`
if block.height() < V4_START_HEIGHT || block.height() > CHECK_V4_START_HEIGHT {
// Do not check the coinbase target between `PREPARE_V4_START_HEIGHT` and `CHECK_V4_START_HEIGHT`
if block.height() < PREPARE_V4_START_HEIGHT || block.height() > CHECK_V4_START_HEIGHT {
if block.coinbase_target() != expected_coinbase_target {
bail!("Invalid coinbase target: expected {}, got {}", expected_coinbase_target, block.coinbase_target())
}
Expand Down

0 comments on commit dc87cfa

Please sign in to comment.