diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2023-02-06 20:47:28 +0000 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2023-02-06 20:47:28 +0000 |
| commit | 73792f35da2910620c832dfb0873212cd5af7b33 (patch) | |
| tree | 451fa4e4739311a1ba2daa1b2fd72f31c3aa2588 /src/hdk.rs | |
| parent | d8496d150db33f4bab4d4c9e0162d65b071aef74 (diff) | |
More idiomatic format strings, version bumps
Diffstat (limited to 'src/hdk.rs')
| -rw-r--r-- | src/hdk.rs | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -15,7 +15,7 @@ const HARDENED: u32 = 0x8000_0000; /// Creates a new extended private key for an account index using the standard /// Ethereum HD path. pub fn derive_index(seed: impl AsRef<[u8]>, account_index: usize) -> Result<PrivateKey> { - derive(seed, &format!("m/44'/60'/0'/0/{}", account_index).parse()?) + derive(seed, &format!("m/44'/60'/0'/0/{account_index}").parse()?) } /// Creates a new extended private key from a seed. @@ -50,9 +50,8 @@ fn derive_slice(seed: &[u8], path: &Path) -> Result<PrivateKey> { let mut child_key = hmac.finalize().into_bytes(); - let child_secret = SecretKey::from_be_bytes(&child_key[..32]).with_context(|| { - format!("path '{}' component #{} yields invalid child key", path, i) - })?; + let child_secret = SecretKey::from_be_bytes(&child_key[..32]) + .with_context(|| format!("path '{path}' component #{i} yields invalid child key"))?; let next_secret = SecretKey::new(*child_secret.as_scalar_core() + *secret.as_scalar_core()); child_key[..32].copy_from_slice(&next_secret.to_be_bytes()); |
