From ea230c52ec06c15749f3649838d08345511c724a Mon Sep 17 00:00:00 2001 From: KaffinPX Date: Wed, 9 Oct 2024 23:09:16 +0300 Subject: [PATCH] Use expect on prefix check --- crypto/addresses/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/addresses/src/lib.rs b/crypto/addresses/src/lib.rs index e34cdbfbe..df98ab399 100644 --- a/crypto/addresses/src/lib.rs +++ b/crypto/addresses/src/lib.rs @@ -230,12 +230,12 @@ impl Address { } #[wasm_bindgen(js_name=validate)] - pub fn validate(address: &str, network: Option) -> bool { + pub fn validate(address: &str, prefix: Option) -> bool { let address = Self::try_from(address).ok(); if let Some(address) = address { - if let Some(network) = network { - let prefix = Prefix::try_from(network.as_str()).unwrap(); + if let Some(prefix) = prefix { + let prefix = Prefix::try_from(prefix.as_str()).expect("Address::verify() - invalid network prefix"); return address.prefix == prefix; } return true;