Merge rust-bitcoin/rust-bitcoin#4043: Implement Default for Script

ab2f709181 Implement Default for Script (jrakibi)

Pull request description:

  This PR implements Default for `Script` to return an empty script.

  *Note: ScriptBuf already has `#[derive(Default)]` in the code so it's already handled*
  Resolves #3735

ACKs for top commit:
  tcharding:
    ACK ab2f709181
  Kixunil:
    ACK ab2f709181
  apoelstra:
    ACK ab2f7091814333b20669d41f1f78e0e52795df08; successfully ran local tests; neat!

Tree-SHA512: c06ba98d9bf8568e323ef9082a7f06756586360d6bef2b93721db7f6e28a777852e494c86319c97b0fd5444a0010d6c679625753534c0e1c8116e452ce8fa9cc
This commit is contained in:
merge-script 2025-02-15 12:57:15 +00:00
commit 0a19d0140c
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 5 additions and 0 deletions

View File

@ -56,6 +56,11 @@ use crate::prelude::{Box, ToOwned, Vec};
#[repr(transparent)]
pub struct Script(pub(in crate::script) [u8]);
impl Default for &Script {
#[inline]
fn default() -> Self { Script::new() }
}
impl ToOwned for Script {
type Owned = ScriptBuf;