Refactor handle_obliteration
This commit is contained in:
parent
614849db78
commit
d2a3147120
@ -74,9 +74,7 @@ impl ProcessState {
|
||||
}
|
||||
|
||||
/// This is a simplified and streamlined validation for obliteration state
|
||||
fn handle_obliteration(&self, members_list: &OutPointMemberMap) -> anyhow::Result<()> {
|
||||
// We need an Apophis role
|
||||
if let Some(apophis) = self.roles.get(SpecialRoles::APOPHIS.to_string().as_str()) {
|
||||
fn handle_obliteration(&self, apophis: &RoleDefinition, members_list: &OutPointMemberMap) -> anyhow::Result<()> {
|
||||
// Apophis should have only one rule
|
||||
if apophis.validation_rules.len() != 1 { return Err(anyhow::Error::msg("Should have only one rule")); };
|
||||
let obliteration_rule = apophis.validation_rules.get(0).unwrap();
|
||||
@ -99,9 +97,6 @@ impl ProcessState {
|
||||
} else {
|
||||
Err(anyhow::Error::msg("Apophis is not satisfied"))
|
||||
}
|
||||
} else {
|
||||
Err(anyhow::Error::msg("Missing an apophis role"))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_valid(&self, previous_state: Option<&ProcessState>, members_list: &OutPointMemberMap) -> anyhow::Result<()> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user