Update to LDK 0.0.107
[ldk-sample] / src / hex_utils.rs
index 70fe28b13f30d8c5cf13ae3c6257bc3f3ece701c..6077a60c52fe5b19b61c4492ce1d07af4cd77e8c 100644 (file)
@@ -1,4 +1,4 @@
-use bitcoin::secp256k1::key::PublicKey;
+use bitcoin::secp256k1::PublicKey;
 
 pub fn to_vec(hex: &str) -> Option<Vec<u8>> {
        let mut out = Vec::with_capacity(hex.len() / 2);
@@ -31,6 +31,9 @@ pub fn hex_str(value: &[u8]) -> String {
 }
 
 pub fn to_compressed_pubkey(hex: &str) -> Option<PublicKey> {
+       if hex.len() != 33 * 2 {
+               return None;
+       }
        let data = match to_vec(&hex[0..33 * 2]) {
                Some(bytes) => bytes,
                None => return None,