Skip to main content

push_data_prefix

Function push_data_prefix 

Source
pub fn push_data_prefix(data_len: usize) -> Result<Vec<u8>, ScriptError>
Expand description

Compute the OP_PUSHDATA prefix bytes for a data payload of the given length.

Returns the prefix that should be prepended to the data when encoding a push operation into raw script bytes.

§Arguments

  • data_len - The length of the data to be pushed.

§Returns

A byte vector containing the appropriate prefix, or an error if the data is too large for the protocol.