Skip to content

Commit

Permalink
fix(protocol): pre release versions should be backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Apr 4, 2024
1 parent df57a3f commit 84bd567
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions sn_protocol/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,11 @@ fn write_network_version_with_slash() -> String {

// Protocol support shall be downward compatible for patch only version update.
// i.e. versions of `A.B.X` shall be considered as a same protocol of `A.B`
// And any pre-release versions `A.B.C-alpha.X` shall be considered as a same protocol of `A.B.C-alpha`
fn get_truncate_version_str() -> &'static str {
let version_str = env!("CARGO_PKG_VERSION");
if version_str.matches('.').count() == 2 {
match version_str.rfind('.') {
Some(pos) => &version_str[..pos],
None => version_str,
}
} else {
version_str
match version_str.rfind('.') {
Some(pos) => &version_str[..pos],
None => version_str,
}
}

0 comments on commit 84bd567

Please sign in to comment.