Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions get_flags_for_height_and_constants() and get_conditions_from_spendbundle() #634

Merged
merged 15 commits into from
Aug 6, 2024
Merged
Prev Previous commit
Next Next commit
add regression test for get_flags
  • Loading branch information
matt-o-how committed Aug 2, 2024
commit 7546defaae285e47634b53bfe410372bf3d1ae0b
38 changes: 38 additions & 0 deletions crates/chia-consensus/src/spendbundle_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,41 @@ pub fn get_flags_for_height_and_constants(height: u32, constants: &ConsensusCons
}
flags
}

#[cfg(test)]
mod tests {
use super::*;
use crate::consensus_constants::TEST_CONSTANTS;

#[test]
fn test_get_flags() {
assert_eq!(
get_flags_for_height_and_constants(
TEST_CONSTANTS.soft_fork4_height - 1,
&TEST_CONSTANTS
),
33554592
);
assert_eq!(
get_flags_for_height_and_constants(
TEST_CONSTANTS.soft_fork5_height - 1,
&TEST_CONSTANTS
),
167772320
);
assert_eq!(
get_flags_for_height_and_constants(
TEST_CONSTANTS.hard_fork_height - 1,
&TEST_CONSTANTS
),
0
);
assert_eq!(
get_flags_for_height_and_constants(
TEST_CONSTANTS.soft_fork5_height + 1,
&TEST_CONSTANTS
),
436207776
);
}
}
Loading