Merge rust-bitcoin/rust-bitcoin#3520: Use fully qualified path in macro

025a8773bf Use fully qualified path in macro (Tobin C. Harding)

Pull request description:

  Using fully qualified paths in macros reduces maintenance burden. We have one macro where we use relative path to access the `psbt` module.

  Refactor only, no external change.

ACKs for top commit:
  apoelstra:
    ACK 025a8773bf63aacdaca011ef000f41a85a961567; successfully ran local tests; will one-ACK merge

Tree-SHA512: eb5923a48ae4d82499679a58375ef7d2e8ba85c91671e350f7be19f0372750a269f44dd2f05f4a70ed0c7f277b160400eb41ff1d42b90e6057f1344be7e11a89
This commit is contained in:
merge-script 2024-10-29 04:28:20 +00:00
commit 34bf82060c
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 4 additions and 4 deletions

View File

@ -115,14 +115,14 @@ macro_rules! impl_psbt_insert_pair {
macro_rules! psbt_insert_hash_pair { macro_rules! psbt_insert_hash_pair {
(&mut $slf:ident.$map:ident <= $raw_key:ident|$raw_value:ident|$hash:path|$hash_type_error:path) => { (&mut $slf:ident.$map:ident <= $raw_key:ident|$raw_value:ident|$hash:path|$hash_type_error:path) => {
if $raw_key.key_data.is_empty() { if $raw_key.key_data.is_empty() {
return Err(psbt::Error::InvalidKey($raw_key)); return Err($crate::psbt::Error::InvalidKey($raw_key));
} }
let key_val: $hash = Deserialize::deserialize(&$raw_key.key_data)?; let key_val: $hash = Deserialize::deserialize(&$raw_key.key_data)?;
match $slf.$map.entry(key_val) { match $slf.$map.entry(key_val) {
btree_map::Entry::Vacant(empty_key) => { btree_map::Entry::Vacant(empty_key) => {
let val: Vec<u8> = Deserialize::deserialize(&$raw_value)?; let val: Vec<u8> = Deserialize::deserialize(&$raw_value)?;
if <$hash as hashes::GeneralHash>::hash(&val) != key_val { if <$hash as hashes::GeneralHash>::hash(&val) != key_val {
return Err(psbt::Error::InvalidPreimageHashPair { return Err($crate::psbt::Error::InvalidPreimageHashPair {
preimage: val.into_boxed_slice(), preimage: val.into_boxed_slice(),
hash: Box::from(key_val.borrow()), hash: Box::from(key_val.borrow()),
hash_type: $hash_type_error, hash_type: $hash_type_error,
@ -130,7 +130,7 @@ macro_rules! psbt_insert_hash_pair {
} }
empty_key.insert(val); empty_key.insert(val);
} }
btree_map::Entry::Occupied(_) => return Err(psbt::Error::DuplicateKey($raw_key)), btree_map::Entry::Occupied(_) => return Err($crate::psbt::Error::DuplicateKey($raw_key)),
} }
} }
} }

View File

@ -12,7 +12,7 @@ use crate::crypto::{ecdsa, taproot};
use crate::prelude::{btree_map, BTreeMap, Borrow, Box, ToOwned, Vec}; use crate::prelude::{btree_map, BTreeMap, Borrow, Box, ToOwned, Vec};
use crate::psbt::map::Map; use crate::psbt::map::Map;
use crate::psbt::serialize::Deserialize; use crate::psbt::serialize::Deserialize;
use crate::psbt::{self, error, raw, Error}; use crate::psbt::{error, raw, Error};
use crate::script::ScriptBuf; use crate::script::ScriptBuf;
use crate::sighash::{ use crate::sighash::{
EcdsaSighashType, InvalidSighashTypeError, NonStandardSighashTypeError, SighashTypeParseError, EcdsaSighashType, InvalidSighashTypeError, NonStandardSighashTypeError, SighashTypeParseError,