Rename TaprootSpendInfo::as_script_map to script_map

The `as_script_map` is a getter not a conversion function (to/into/as),
as such it should not include the prefix `as_`.

Deprecate `as_script_map` in favour of `script_map`.
This commit is contained in:
Tobin C. Harding 2023-06-02 16:55:26 +10:00
parent 6a04ca12e0
commit ccb6e3eeba
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 5 additions and 1 deletions

View File

@ -251,6 +251,9 @@ impl TaprootSpendInfo {
/// Returns the parity of the output key. See also [`TaprootSpendInfo::output_key`]. /// Returns the parity of the output key. See also [`TaprootSpendInfo::output_key`].
pub fn output_key_parity(&self) -> secp256k1::Parity { self.output_key_parity } pub fn output_key_parity(&self) -> secp256k1::Parity { self.output_key_parity }
/// Returns a reference to the internal script map.
pub fn script_map(&self) -> &ScriptMerkleProofMap { &self.script_map }
/// Computes the [`TaprootSpendInfo`] from `internal_key` and `node`. /// Computes the [`TaprootSpendInfo`] from `internal_key` and `node`.
/// ///
/// This is useful when you want to manually build a taproot tree without using /// This is useful when you want to manually build a taproot tree without using
@ -289,7 +292,8 @@ impl TaprootSpendInfo {
} }
/// Returns the internal script map. /// Returns the internal script map.
pub fn as_script_map(&self) -> &ScriptMerkleProofMap { &self.script_map } #[deprecated(since = "0.31.0", note = "use Self::script_map instead")]
pub fn as_script_map(&self) -> &ScriptMerkleProofMap { self.script_map() }
/// Constructs a [`ControlBlock`] for particular script with the given version. /// Constructs a [`ControlBlock`] for particular script with the given version.
/// ///