From 84bd567816c4b5691f1ceea0a9d1255092f60483 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Thu, 4 Apr 2024 19:06:44 +0530 Subject: [PATCH] fix(protocol): pre release versions should be backward compatible --- sn_protocol/src/version.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sn_protocol/src/version.rs b/sn_protocol/src/version.rs index 1c5a6bac24..abc959cdca 100644 --- a/sn_protocol/src/version.rs +++ b/sn_protocol/src/version.rs @@ -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, } }