Skip to content

Commit 378eaa6

Browse files
authored
Merge pull request #101 from Foundation-Devices/SFT-6235-incorrect-xfp-warning-support
SFT-6235: added list of fingerprints found when ours isn't included
2 parents 304256b + 3d16122 commit 378eaa6

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/psbt.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ impl OutputKind {
170170
pub fn is_non_change_self_send(&self) -> bool {
171171
match self {
172172
OutputKind::Transfer { .. } => true,
173-
OutputKind::Change(_) | OutputKind::External(_) | OutputKind::OpReturn(_) | OutputKind::Suspicious(_) => false,
173+
OutputKind::Change(_)
174+
| OutputKind::External(_)
175+
| OutputKind::OpReturn(_)
176+
| OutputKind::Suspicious(_) => false,
174177
}
175178
}
176179
}
@@ -217,7 +220,7 @@ pub enum Error {
217220

218221
/// No inputs in the PSBT match the wallet fingerprint.
219222
#[error("transaction cannot be signed, no input matches the wallet fingerprint")]
220-
CantSign,
223+
CantSign(HashSet<Fingerprint>),
221224

222225
/// Failed to calculate taproot key
223226
#[error("failed to calculate taproot key")]
@@ -426,7 +429,17 @@ where
426429
});
427430

428431
if !is_fingerprint_present {
429-
return Err(Error::CantSign);
432+
let mut fingerprints = HashSet::<Fingerprint>::new();
433+
for input in psbt.inputs.iter() {
434+
for bip32_fingerprint in input.bip32_derivation.iter().map(|(_, (v, _))| v) {
435+
fingerprints.insert(*bip32_fingerprint);
436+
}
437+
438+
for tap_fingerprint in input.tap_key_origins.iter().map(|(_, (_, (v, _)))| v) {
439+
fingerprints.insert(*tap_fingerprint);
440+
}
441+
}
442+
return Err(Error::CantSign(fingerprints));
430443
}
431444

432445
for (i, input) in psbt.inputs.iter().enumerate() {

0 commit comments

Comments
 (0)