Merge #739: signer: Fix a small borrowck-related fixme

e07637c1567dc85f6b21cbc7f07c7205b0c634f4 signer: Fix a small borrowck-related fixme (Steven Roose)

Pull request description:

ACKs for top commit:
  darosior:
    ACK e07637c1567dc85f6b21cbc7f07c7205b0c634f4

Tree-SHA512: ad6233d0791aa8edc005640954dd40835f141e6629b27e7e13313459cc23523da05a668972307c2ddd83d6930b598b9842bb26f5271f9198256c093ff4c34100
This commit is contained in:
Antoine Poinsot 2023-10-24 17:08:22 +02:00
commit 42578609e2
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -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,