Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit aee12fe

Browse files
Clippy fixes
1 parent 27e1532 commit aee12fe

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

mutiny-core/src/blindauth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ fn create_blind_auth_secret(
357357
) -> Result<DerivableSecret, MutinyError> {
358358
let context = Secp256k1::new();
359359

360-
let shared_key = create_root_child_key(&context, xprivkey, ChildKey::BlindAuthChildKey)?;
360+
let shared_key = create_root_child_key(&context, xprivkey, ChildKey::BlindAuth)?;
361361
let xpriv = shared_key.derive_priv(
362362
&context,
363363
&DerivationPath::from(vec![ChildNumber::from_hardened_idx(

mutiny-core/src/federation.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ fn create_federation_secret(
709709
) -> Result<DerivableSecret, MutinyError> {
710710
let context = Secp256k1::new();
711711

712-
let shared_key = create_root_child_key(&context, xprivkey, ChildKey::FederationChildKey)?;
712+
let shared_key = create_root_child_key(&context, xprivkey, ChildKey::Federation)?;
713713
let xpriv = shared_key.derive_priv(
714714
&context,
715715
&DerivationPath::from(vec![ChildNumber::from_hardened_idx(
@@ -1086,7 +1086,7 @@ fn fedimint_mnemonic_generation() {
10861086
let root_mnemonic = Mnemonic::from_str(mnemonic_str).expect("could not generate");
10871087
let xpriv = ExtendedPrivKey::new_master(Network::Regtest, &root_mnemonic.to_seed("")).unwrap();
10881088
let context = Secp256k1::new();
1089-
let child_key = create_root_child_key(&context, xpriv, ChildKey::FederationChildKey).unwrap();
1089+
let child_key = create_root_child_key(&context, xpriv, ChildKey::Federation).unwrap();
10901090

10911091
let child_mnemonic = mnemonic_from_xpriv(child_key).unwrap();
10921092
assert_ne!(mnemonic_str, child_mnemonic.to_string());
@@ -1100,8 +1100,7 @@ fn fedimint_mnemonic_generation() {
11001100
let xpriv2 =
11011101
ExtendedPrivKey::new_master(Network::Regtest, &root_mnemonic2.to_seed("")).unwrap();
11021102
let context2 = Secp256k1::new();
1103-
let child_key2 =
1104-
create_root_child_key(&context2, xpriv2, ChildKey::FederationChildKey).unwrap();
1103+
let child_key2 = create_root_child_key(&context2, xpriv2, ChildKey::Federation).unwrap();
11051104

11061105
let child_mnemonic2 = mnemonic_from_xpriv(child_key2).unwrap();
11071106
assert_ne!(mnemonic_str2, child_mnemonic2.to_string());

mutiny-core/src/hermes.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use lightning::util::logger::Logger;
1414
use lightning::{log_error, log_warn};
1515
use nostr::{nips::nip04::decrypt, Keys};
1616
use nostr::{Filter, Kind, Timestamp};
17-
use nostr_sdk::{Client, NostrSigner, RelayPoolNotification};
17+
use nostr_sdk::{Client, RelayPoolNotification};
1818
use reqwest::Method;
1919
use serde::{Deserialize, Serialize};
2020
use tbs::unblind_signature;
@@ -31,6 +31,7 @@ use crate::{
3131
};
3232

3333
const HERMES_SERVICE_ID: u32 = 1;
34+
#[allow(dead_code)]
3435
const HERMES_FREE_PLAN_ID: u32 = 1;
3536
const HERMES_PAID_PLAN_ID: u32 = 2;
3637

@@ -115,7 +116,7 @@ impl<S: MutinyStorage> HermesClient<S> {
115116
let logger = self.logger.clone();
116117
let stop = self.stop.clone();
117118
let client = self.client.clone();
118-
let public_key = self.public_key.clone();
119+
let public_key = self.public_key;
119120
let storage = self.storage.clone();
120121
let primary_key = self.primary_key.clone();
121122

@@ -252,7 +253,7 @@ impl<S: MutinyStorage> HermesClient<S> {
252253
}
253254

254255
fn find_hermes_token(
255-
tokens: &Vec<SignedToken>,
256+
tokens: &[SignedToken],
256257
service_id: u32,
257258
plan_id: u32,
258259
) -> Option<&SignedToken> {

mutiny-core/src/key.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ use bitcoin::{
66
use crate::error::MutinyError;
77

88
pub(crate) enum ChildKey {
9-
NodeChildKey,
10-
FederationChildKey,
11-
BlindAuthChildKey,
9+
Node,
10+
Federation,
11+
BlindAuth,
1212
}
1313

1414
impl ChildKey {
1515
pub(crate) fn to_child_number(&self) -> u32 {
1616
match self {
17-
ChildKey::NodeChildKey => 0,
18-
ChildKey::FederationChildKey => 1,
19-
ChildKey::BlindAuthChildKey => 2,
17+
ChildKey::Node => 0,
18+
ChildKey::Federation => 1,
19+
ChildKey::BlindAuth => 2,
2020
}
2121
}
2222
}
@@ -41,11 +41,11 @@ fn run_key_generation_tests() {
4141
let mnemonic = Mnemonic::from_str("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about").expect("could not generate");
4242
let xpriv = ExtendedPrivKey::new_master(Network::Testnet, &mnemonic.to_seed("")).unwrap();
4343

44-
let first_root_key = create_root_child_key(&context, xpriv, ChildKey::NodeChildKey);
45-
let copy_root_key = create_root_child_key(&context, xpriv, ChildKey::NodeChildKey);
44+
let first_root_key = create_root_child_key(&context, xpriv, ChildKey::Node);
45+
let copy_root_key = create_root_child_key(&context, xpriv, ChildKey::Node);
4646
assert_eq!(first_root_key, copy_root_key);
4747

48-
let federation_root_key = create_root_child_key(&context, xpriv, ChildKey::FederationChildKey);
48+
let federation_root_key = create_root_child_key(&context, xpriv, ChildKey::Federation);
4949
assert_ne!(first_root_key, federation_root_key);
5050
}
5151

mutiny-core/src/keymanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ pub(crate) fn create_keys_manager<S: MutinyStorage>(
233233
) -> Result<PhantomKeysManager<S>, MutinyError> {
234234
let context = Secp256k1::new();
235235

236-
let shared_key = create_root_child_key(&context, xprivkey, ChildKey::NodeChildKey)?;
236+
let shared_key = create_root_child_key(&context, xprivkey, ChildKey::Node)?;
237237

238238
let xpriv = shared_key.derive_priv(
239239
&context,

mutiny-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ impl<S: MutinyStorage> MutinyWalletBuilder<S> {
891891
let blind_auth_client = if let Some(auth_client) = self.auth_client.clone() {
892892
if let Some(blind_auth_url) = self.blind_auth_url {
893893
let s = Arc::new(BlindAuthClient::new(
894-
self.xprivkey.clone(),
894+
self.xprivkey,
895895
auth_client,
896896
network,
897897
blind_auth_url,
@@ -911,7 +911,7 @@ impl<S: MutinyStorage> MutinyWalletBuilder<S> {
911911
if let Some(hermes_url) = self.hermes_url {
912912
let s = Arc::new(
913913
HermesClient::new(
914-
self.xprivkey.clone(),
914+
self.xprivkey,
915915
hermes_url,
916916
federations.clone(),
917917
blind_auth_client,

mutiny-core/src/nostr/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use lightning::util::logger::Logger;
2020
use lightning::{log_debug, log_error, log_info, log_warn};
2121
use lightning_invoice::Bolt11Invoice;
2222
use lnurl::lnurl::LnUrl;
23-
use nostr::key::SecretKey;
2423
use nostr::nips::nip04::{decrypt, encrypt};
2524
use nostr::nips::nip47::*;
2625
use nostr::{Event, EventBuilder, EventId, Filter, JsonUtil, Keys, Kind, Metadata, Tag, Timestamp};

0 commit comments

Comments
 (0)