Skip to content

Commit a9ce7d9

Browse files
committed
f Extract max key len to const
1 parent 2ebb0d3 commit a9ce7d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning-persister/src/utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use lightning::util::persist::KVSTORE_NAMESPACE_KEY_ALPHABET;
22
use lightning::util::string::PrintableString;
33

4+
const KVSTORE_MAX_KEY_LEN: usize = 120;
5+
46
pub(crate) fn is_valid_kvstore_str(key: &str) -> bool {
5-
key.len() <= 120 && key.chars().all(|c| KVSTORE_NAMESPACE_KEY_ALPHABET.contains(c))
7+
key.len() <= KVSTORE_MAX_KEY_LEN && key.chars().all(|c| KVSTORE_NAMESPACE_KEY_ALPHABET.contains(c))
68
}
79

810
pub(crate) fn check_namespace_key_validity(namespace: &str, sub_namespace: &str, key: Option<&str>, operation: &str) -> Result<(), std::io::Error> {

0 commit comments

Comments
 (0)