Skip to content

Commit

Permalink
Rename DestinationSigError::PublicKeyToAddressMismatch to PublicKeyTo…
Browse files Browse the repository at this point in the history
…HashMismatch
  • Loading branch information
ImplOfAnImpl committed Nov 14, 2024
1 parent b0938c5 commit 958463f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chainstate/test-suite/src/tests/htlc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ fn spend_htlc_with_secret(#[case] seed: Seed) {
ConnectTransactionError::InputCheck(InputCheckError::new(
0,
tx_verifier::error::ScriptError::Signature(
DestinationSigError::PublicKeyToAddressMismatch
DestinationSigError::PublicKeyToHashMismatch
)
))
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ fn verify_wrong_destination(#[case] seed: Seed) {
(
&dest_addr,
&dest_addr2,
&assert_result(Err(DestinationSigError::PublicKeyToAddressMismatch)),
&assert_result(Err(DestinationSigError::PublicKeyToHashMismatch)),
),
(
&dest_addr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn verify_public_key_hash_spending(
) -> Result<(), DestinationSigError> {
let calculated_addr = PublicKeyHash::from(&sig_components.public_key);
if calculated_addr != *spendee_addr {
return Err(DestinationSigError::PublicKeyToAddressMismatch);
return Err(DestinationSigError::PublicKeyToHashMismatch);
}
let msg = sighash.encode();
if !sig_components.public_key.verify_message(&sig_components.signature, &msg) {
Expand All @@ -67,7 +67,7 @@ pub fn sign_public_key_hash_spending<R: Rng + CryptoRng>(
let public_key = PublicKey::from_private_key(private_key);
let calculated_addr = PublicKeyHash::from(&public_key);
if calculated_addr != *spendee_addr {
return Err(DestinationSigError::PublicKeyToAddressMismatch);
return Err(DestinationSigError::PublicKeyToHashMismatch);
}
sign_public_key_hash_spending_impl(private_key, public_key, sighash, rng)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ mod test {
#[rstest]
#[trace]
#[case(Seed::from_entropy())]
fn produce_signature_address_mismatch(#[case] seed: Seed) {
fn produce_signature_pub_key_hash_mismatch(#[case] seed: Seed) {
let mut rng = test_utils::random::make_seedable_rng(seed);

let (private_key, _) = PrivateKey::new_from_rng(&mut rng, KeyKind::Secp256k1Schnorr);
Expand All @@ -251,7 +251,7 @@ mod test {

for sighash_type in sig_hash_types() {
assert_eq!(
Err(DestinationSigError::PublicKeyToAddressMismatch),
Err(DestinationSigError::PublicKeyToHashMismatch),
StandardInputSignature::produce_uniparty_signature_for_input(
&private_key,
sighash_type,
Expand Down
4 changes: 2 additions & 2 deletions common/src/chain/transaction/signature/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ pub enum DestinationSigError {
DecodingWitnessFailed,
#[error("Signature verification failed")]
SignatureVerificationFailed,
#[error("Public key to address mismatch")]
PublicKeyToAddressMismatch,
#[error("Public key to public key hash mismatch")]
PublicKeyToHashMismatch,
#[error("Address authorization decoding failed")]
AddressAuthDecodingFailed(String),
#[error("Signature decoding failed")]
Expand Down

0 comments on commit 958463f

Please sign in to comment.