From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Thu, 15 Sep 2022 20:06:32 +0000 (+0000) Subject: Merge pull request #70 from valentinewallace/2022-09-ldk-0.0.111 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=5cc67b2bbeb4b7e308226d82b608a51a0564fc50;hp=97ea6989f2ffe859614cc6c7e0a756e2c1efddb7;p=ldk-sample Merge pull request #70 from valentinewallace/2022-09-ldk-0.0.111 Update to LDK 0.0.111 --- diff --git a/src/hex_utils.rs b/src/hex_utils.rs index 6077a60..8b853db 100644 --- a/src/hex_utils.rs +++ b/src/hex_utils.rs @@ -1,4 +1,5 @@ use bitcoin::secp256k1::PublicKey; +use std::fmt::Write; pub fn to_vec(hex: &str) -> Option> { let mut out = Vec::with_capacity(hex.len() / 2); @@ -23,9 +24,9 @@ pub fn to_vec(hex: &str) -> Option> { #[inline] pub fn hex_str(value: &[u8]) -> String { - let mut res = String::with_capacity(64); + let mut res = String::with_capacity(2 * value.len()); for v in value { - res += &format!("{:02x}", v); + write!(&mut res, "{:02x}", v).expect("Unable to write"); } res }