| 195 | } |
| 196 | |
| 197 | fn verify_public_nonces( |
| 198 | all_nonces: &HashMap<usize, HashMap<PublicKey, PubNonce>>, |
| 199 | all_sigs: &HashMap<usize, HashMap<PublicKey, Signature>>, |
| 200 | txid: Txid, |
| 201 | tx_name: &'static str, |
| 202 | ) -> Result<(), Error> { |
| 203 | for (i, nonces) in all_nonces { |
| 204 | for (pubkey, nonce) in nonces { |
| 205 | if !verify_public_nonce(&all_sigs[i][pubkey], nonce, &XOnlyPublicKey::from(*pubkey)) { |
| 206 | eprintln!( |
| 207 | "Failed to verify public nonce for pubkey {pubkey} on tx:input {txid}:{i}." |
| 208 | ); |
| 209 | return Err(Error::Validation(ValidationError::NoncesValidationFailed( |
| 210 | tx_name, *pubkey, txid, *i, |
| 211 | ))); |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | Ok(()) |
| 217 | } |
| 218 | |
| 219 | pub fn verify_public_nonces_for_tx( |
| 220 | tx: &(impl BaseTransaction + PreSignedMusig2Transaction), |