From 41652caf05a8e851408de89c76667e9b75f8d31b Mon Sep 17 00:00:00 2001 From: sanket1729 Date: Thu, 19 Jan 2023 14:50:32 -0800 Subject: [PATCH] Introduce is_spend_standard method --- bitcoin/src/address.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bitcoin/src/address.rs b/bitcoin/src/address.rs index de76ad79..cdefaf7f 100644 --- a/bitcoin/src/address.rs +++ b/bitcoin/src/address.rs @@ -848,10 +848,20 @@ impl Address { self.address_type_internal() } + /// Checks whether or not the address is following Bitcoin standardness rules when + /// *spending* from this address. This method should *NOT* called by senders. For forward + /// compatibility, the senders must send to any [`Address`]. Receivers can use this method to + /// check whether or not they can spend from this address. + /// + /// SegWit addresses with unassigned witness versions or non-standard program sizes are + /// considered non-standard. + pub fn is_spend_standard(&self) -> bool { self.address_type().is_some() } + /// Checks whether or not the address is following Bitcoin standardness rules. /// /// SegWit addresses with unassigned witness versions or non-standard program sizes are /// considered non-standard. + #[deprecated(since = "0.30.0", note = "Use Address::is_spend_standard instead")] pub fn is_standard(&self) -> bool { self.address_type().is_some() } /// Constructs an [`Address`] from an output script (`scriptPubkey`).