From e07637c1567dc85f6b21cbc7f07c7205b0c634f4 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 23 Oct 2023 20:14:02 +0100 Subject: [PATCH] signer: Fix a small borrowck-related fixme --- src/signer.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/signer.rs b/src/signer.rs index 7197a3b8..495a6bb5 100644 --- a/src/signer.rs +++ b/src/signer.rs @@ -260,19 +260,18 @@ impl HotSigner { .expect("Sighash is always 32 bytes."); // Then provide a signature for all the keys they asked for. - // FIXME: get rid of this clone somehow.. Can't we just tell the borrow checker it's - // fine? - for (curr_pubkey, (fingerprint, der_path)) in psbt.inputs[i].bip32_derivation.clone() { - if fingerprint != master_fingerprint { + let input = &mut psbt.inputs[i]; // for borrowck reasons + for (curr_pubkey, (fingerprint, der_path)) in input.bip32_derivation.iter() { + if *fingerprint != master_fingerprint { continue; } - let privkey = self.xpriv_at(&der_path, secp).to_priv(); + let privkey = self.xpriv_at(der_path, secp).to_priv(); let pubkey = privkey.public_key(secp); - if pubkey.inner != curr_pubkey { + if pubkey.inner != *curr_pubkey { return Err(SignerError::InsanePsbt); } let sig = secp.sign_ecdsa_low_r(&sighash, &privkey.inner); - psbt.inputs[i].partial_sigs.insert( + input.partial_sigs.insert( pubkey, ecdsa::Signature { sig,