diff --git a/bitcoin/src/blockdata/script.rs b/bitcoin/src/blockdata/script.rs index dc3a0f91..fc5fb5e7 100644 --- a/bitcoin/src/blockdata/script.rs +++ b/bitcoin/src/blockdata/script.rs @@ -1163,7 +1163,16 @@ impl ScriptBuf { .into_script() } + /// Converts byte vector into script. + /// + /// This method doesn't (re)allocate. + pub fn from_bytes(bytes: Vec) -> Self { + ScriptBuf(bytes) + } + /// Converts the script into a byte vector. + /// + /// This method doesn't (re)allocate. pub fn into_bytes(self) -> Vec { self.0 } /// Computes the P2SH output corresponding to this redeem script.