Merge rust-bitcoin/rust-bitcoin#2294: Deprecate `Script::is_provably_unspendable`

089ce8f0fb Deprecate `Script::is_provably_unspendable` (Martin Habovstiak)

Pull request description:

  This method is not really that useful because it checked an arbitrary condition. There already exists `OP_RETURN` semantics and the method didn't cover all possible ways the script may be invalid.

  This deprecates the method and documents why.

  Closes #2191

ACKs for top commit:
  apoelstra:
    ACK 089ce8f0fb
  tcharding:
    ACK 089ce8f0fb
  sanket1729:
    ACK 089ce8f0fb

Tree-SHA512: 044f1c06fb8cbea4f84817be41bf10315f690b2a42748a07c1dd1eb0ba10932456780956fc628fec4bf57fe0722129537874a77be482d6660f9e02de5fc5a8a0
This commit is contained in:
Andrew Poelstra 2024-01-08 15:07:01 +00:00
commit 6aaaae6ffc
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 5 additions and 1 deletions

View File

@ -353,7 +353,11 @@ impl Script {
} }
} }
/// Checks whether a script can be proven to have no satisfying input. /// Checks whether a script is trivially known to have no satisfying input.
///
/// This method has potentially confusing semantics and an unclear purpose, so it's going to be
/// removed. Use `is_op_return` if you want `OP_RETURN` semantics.
#[deprecated(since = "TBD", note = "The method is not very useful, you might want `is_op_return`")]
#[inline] #[inline]
pub fn is_provably_unspendable(&self) -> bool { pub fn is_provably_unspendable(&self) -> bool {
use crate::blockdata::opcodes::Class::{IllegalOp, ReturnOp}; use crate::blockdata::opcodes::Class::{IllegalOp, ReturnOp};