Skip to content

Commit

Permalink
Ensure enr csc is written as u8
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Aug 28, 2024
1 parent 667d7f1 commit 3cffa74
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion beacon_node/lighthouse_network/src/discovery/enr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ pub fn build_enr<E: EthSpec>(
} else {
spec.custody_requirement
};
builder.add_value(PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY, &custody_subnet_count);
let csc: u8 = custody_subnet_count
.try_into()
.map_err(|_| "custody_subnet_count cannot exceed u8::MAX".to_string())?;
builder.add_value(PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY, &csc);
}

builder
Expand Down

0 comments on commit 3cffa74

Please sign in to comment.